WebBrowserNavigatingEventArgs Class
Collapse the table of content
Expand the table of content

WebBrowserNavigatingEventArgs Class


Provides data for the WebBrowser::Navigating event.

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


public ref class WebBrowserNavigatingEventArgs : CancelEventArgs

System_CAPS_pubmethodWebBrowserNavigatingEventArgs(Uri^, String^)

Initializes a new instance of the WebBrowserNavigatingEventArgs class.


Gets or sets a value indicating whether the event should be canceled.(Inherited from CancelEventArgs.)


Gets the name of the Web page frame in which the new document will be loaded.


Gets the location of the document to which the WebBrowser control is navigating.


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)


Creates a shallow copy of the current Object.(Inherited from Object.)


Returns a string that represents the current object.(Inherited from Object.)

The WebBrowser::Navigating event occurs before the WebBrowser control navigates to a new document. You can handle this event to cancel navigation before it begins if certain conditions have not been met, for example, when the user has not completely filled out a form. To do this, set the Cancel property of the WebBrowserNavigatingEventArgs object passed to the event handler to true. You can also use this object to retrieve the location of the new document through the Url property. If the new document will be displayed in a Web page frame, you can retrieve the name of the frame through the TargetFrameName property.

Legacy Code Example

The following code example demonstrates how to use a handler for the WebBrowser::Navigating event to cancel navigation when a Web page form has not been filled in. The WebBrowser::Document property is used to determine whether the form input field contains a value. This example requires that your form contains a WebBrowser control called webBrowser1.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
© 2015 Microsoft