WebBrowserNavigatingEventArgs Class
Provides data for the WebBrowser::Navigating event.
System::EventArgs
System.ComponentModel::CancelEventArgs
System.Windows.Forms::WebBrowserNavigatingEventArgs
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The WebBrowserNavigatingEventArgs type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | WebBrowserNavigatingEventArgs | Initializes a new instance of the WebBrowserNavigatingEventArgs class. |
| Name | Description | |
|---|---|---|
![]() | Cancel | Gets or sets a value indicating whether the event should be canceled. (Inherited from CancelEventArgs.) |
![]() | TargetFrameName | Gets the name of the Web page frame in which the new document will be loaded. |
![]() | Url | Gets the location of the document to which the WebBrowser control is navigating. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | 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.
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.
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.
