WebBrowserArray.Navigating 事件


發生於 WebBrowser 控制項巡覽至新文件之前。Occurs before the WebBrowser control navigates to a new document.

 event System::Windows::Forms::WebBrowserNavigatingEventHandler ^ Navigating;
public event System.Windows.Forms.WebBrowserNavigatingEventHandler Navigating;
member this.Navigating : System.Windows.Forms.WebBrowserNavigatingEventHandler 
Public Event Navigating As WebBrowserNavigatingEventHandler 


每當設定下列其中一個屬性或呼叫方法時,WebBrowser 控制項會流覽至新的檔:The WebBrowser control navigates to a new document whenever one of the following properties is set or methods is called:

如果尚未符合特定條件(例如,使用者尚未完全填寫表單),您可以處理 Navigating 事件來取消導覽。You can handle the Navigating event to cancel navigation if certain conditions have not been met, for example, when the user has not completely filled out a form. 若要取消導覽,請將傳遞至事件處理常式之 WebBrowserNavigatingEventArgs 物件的 Cancel 屬性設定為 trueTo cancel navigation, set the Cancel property of the WebBrowserNavigatingEventArgs object passed to the event handler to true. 您也可以使用這個物件,透過 Url 屬性抓取新檔的 URL。You can also use this object to retrieve the URL of the new document through the Url property. 如果新檔會顯示在網頁框架中,您可以透過 TargetFrameName 屬性來抓取框架的名稱。If the new document will be displayed in a Web page frame, you can retrieve the name of the frame through the TargetFrameName property.

處理 Navigated 事件,以在 WebBrowser 控制項完成導覽並于新位置開始載入檔時,接收通知。Handle the Navigated event to receive notification when the WebBrowser control finishes navigation and has begun loading the document at the new location. 處理 DocumentCompleted 事件,以在 WebBrowser 控制項完成載入新檔時收到通知。Handle the DocumentCompleted event to receive notification when the WebBrowser control finishes loading the new document.

如需如何處理事件的詳細資訊,請參閱處理和引發事件For more information about how to handle events, see Handling and Raising Events.


Microsoft.VisualBasic.Compatibility.VB6 命名空間中的函式和物件都是供這些工具使用,以便從 Visual Basic 6.0 升級至 Visual Basic。Functions and objects in the Microsoft.VisualBasic.Compatibility.VB6 namespace are provided for use by the tools for upgrading from Visual Basic 6.0 to Visual Basic. 在大多數情況下,這些函式和物件會複製在 .NET Framework.NET Framework 的其他命名空間中可以找到的功能。In most cases, these functions and objects duplicate functionality that you can find in other namespaces in the .NET Framework.NET Framework. 只有當 Visual Basic 6.0 程式碼模型與 .NET Framework.NET Framework 實作有顯著差異時,才需要這些項目。They are necessary only when the Visual Basic 6.0 code model differs significantly from the .NET Framework.NET Framework implementation.