How to use Web Browser control in Visual Studio 2005

Lets Start

1. Create a new Windows Application.

1.gif

2. Now add a Panel and Dock it to the top. (For the Address Bar and GO Button)

2.gif

3. Now add  web browser control from the toolbox.

77.gif

4. Add the label, textbox and button on the panel.

77.5.gif

5. Now the basic structure is ready, its time for the real action.

Double click on the Button to generate a event handler and type the following code

private void button1_Click(object sender, EventArgs e)
{
     webBrowser1.Navigate(textBox1.Text);
}

6. Now, just build your solution and type any website name in the address bar and click on go button.

Note: The website address should be in the format http://www.websitename.com

88.gif

Extra Features

you can add several extra features to the Windows form that you have created..

  • Status Strip
  • Menu Strip
  • Accept Button (to generate the event when user hits ENTER in the address bar)

 

Up Next
    Ebook Download
    View all
    Learn
    View all