Open a web site

Y

Yael

Hi,
I'm using vs.net 2003
How can I open a web site (in IE) from my add-in outlook 2003 button event?

private void MyButton_Click(CommandBarButton cmdBarbutton,ref bool cancel)
{
here I want to open http://www.myplace.com
}
 
K

Ken Slovak - [MVP - Outlook]

Get a reference to either a browser control or IE itself and use the URL to
the Web site in a call to Navigate in the browser control or IE.
 
Y

Yael

Tnx,
Could you give me a link for example what I need to write in this method for
opening the web?
private void MyButton_Click(CommandBarButton cmdBarbutton,ref bool cancel)
{
}
 
K

Ken Slovak - [MVP - Outlook]

Assuming you are adding a Web browser control to a Windows form class called
browseWindow and the control is WebBrowser1:

private void MyButton_Click(CommandBarButton cmdBarbutton,ref bool cancel)
{
browseWindow window = new browseWindow();
window.WebBrowser1.Navigate(strURL);
}
 
Y

Yael

No, I want to open a web site by clicking on the button add-in in a toolbar
outlook, not from a Windows form class.
Is it's possiable?
 
K

Ken Slovak - [MVP - Outlook]

You have to have a container to hold a WebBrowser control to display the Web
site unless you directly automate IE. Either way the button click will
either launch the form which will load the URL into the WebBrowser control
or you will pass the URL to the IE Navigate method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top