Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

WebBrowser.Navigated Event

Occurs when the WebBrowser control has navigated to a new document and has begun loading it.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public event WebBrowserNavigatedEventHandler Navigated

The WebBrowser control navigates to a new document whenever one of the following properties is set or methods is called:

Handle the Navigated event to receive notification when the WebBrowser control has navigated to a new document. When the Navigated event occurs, the new document has begun loading, which means you can access the loaded content through the Document, DocumentText, and DocumentStream properties. Handle the DocumentCompleted event to receive notification when the WebBrowser control finishes loading the new document.

You can also receive notification before navigation begins by handling the Navigating event. Handling this event lets you cancel navigation if certain conditions have not been met, for example, the user has not completely filled out a form.

For more information about handling events, see Consuming Events.

The following code example demonstrates how to use a handler for the Navigated event to implement an address bar for the WebBrowser control. This example requires that your form contains a WebBrowser control called webBrowser1, a TextBox control called TextBoxAddress, and a Button control called ButtonGo. When you type a URL into the text box and press ENTER or click the Go button, the WebBrowser control navigates to the URL specified. When you navigate by clicking a hyperlink, the text box automatically updates to display the current URL.

For the complete code example, see How to: Add Web Browser Capabilities to a Windows Forms Application.

// Navigates to the URL in the address box when 
// the ENTER key is pressed while the ToolStripTextBox has focus.
private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e)
    if (e.KeyCode == Keys.Enter)

// Navigates to the URL in the address box when 
// the Go button is clicked.
private void goButton_Click(object sender, EventArgs e)

// Navigates to the given URL if it is valid.
private void Navigate(String address)
    if (String.IsNullOrEmpty(address)) return;
    if (address.Equals("about:blank")) return;
    if (!address.StartsWith("http://") &&
        address = "http://" + address;
        webBrowser1.Navigate(new Uri(address));
    catch (System.UriFormatException)

// Updates the URL in TextBoxAddress upon navigation.
private void webBrowser1_Navigated(object sender,
    WebBrowserNavigatedEventArgs e)
    toolStripTextBox1.Text = webBrowser1.Url.ToString();

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2015 Microsoft