如何:使用 WebBrowser 控件导航到 URL

下面的代码示例演示如何将 WebBrowser 控件导航到特定 URL。

若要确定新文档何时完全加载,请处理该 DocumentCompleted 事件。 有关此事件的演示,请参阅 How to: Print with a WebBrowser Control.

示例:

Me.webBrowser1.Navigate("https://www.microsoft.com")
this.webBrowser1.Navigate("https://www.microsoft.com");

编译代码

此示例需要:

  • 名为 WebBrowserwebBrowser1 控件。

  • SystemSystem.Windows.Forms 程序集的引用。

另请参阅