articles

Home / DeveloperSection / Articles / WebBrowser Control in C#.Net

WebBrowser Control in C#.Net

WebBrowser Control in C#.Net

John Smith 27152 24-Jan-2011

WebBrowser Control in C#.Net

A WebBrowser Control Enables to navigate Web pages inside your form. Navigate method of WebBrowser Control - Loads the document into the WebBrowser control.

How to use WebBrowser Control

Drag and drop WebBrowser Control from the toolbox on window Form.

WebBrowser Control in C#.Net

Designing GUI

Now I add a label, TextBox, and a button.

WebBrowser Control in C#.Net

Code:

Write below code in a button click.

WebBrowser Control in C#.Net

Double click on Click event.

private void btnGo_Click(object sender, EventArgs e)
{
         //The Navigate method of browser control views a page in the viewer.
           webBrowser1.Navigate(textBox1.Text);
}

Run the project

WebBrowser Control in C#.Net

When you enter URL address in textbox and click the Go button then click event will fire and navigate method will open a website which URL address is given in TextBox.

WebBrowser Control in C#.Net

WebBrowser Properties

The URL property:  Gets or sets the URL of the current Web page. Setting this property navigates the control to the new URL.

AllowNavigation:  Gets or sets a value indicating whether the control can navigate to another page after its initial page has been loaded. 

TabStop: Gets or sets a value indicating whether the user can give the focus to this control using the TAB key. 


Updated 17-Sep-2020
I am best.

Leave Comment

Comments

Liked By