System.Windows.Forms.WebBrowser.Navigating Event

Occurs before the System.Windows.Forms.WebBrowser control navigates to a new document.

Syntax

public event WebBrowserNavigatingEventHandler Navigating

Remarks

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

You can handle the WebBrowser.Navigating event to cancel navigation if certain conditions have not been met, for example, when the user has not completely filled out a form. To cancel navigation, set the System.ComponentModel.CancelEventArgs.Cancel property of the System.Windows.Forms.WebBrowserNavigatingEventArgs object passed to the event handler to true. You can also use this object to retrieve the URL of the new document through the WebBrowserNavigatingEventArgs.Url property. If the new document will be displayed in a Web page frame, you can retrieve the name of the frame through the WebBrowserNavigatingEventArgs.TargetFrameName property.

Handle the WebBrowser.Navigated event to receive notification when the System.Windows.Forms.WebBrowser control finishes navigation and has begun loading the document at the new location. Handle the WebBrowser.DocumentCompleted event to receive notification when the System.Windows.Forms.WebBrowser control finishes loading the new document.

For more information about handling events, see Consuming Events.

Requirements

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