Webbrowser1更改页面后立即打开网页?

时间:2013-02-10 02:30:34

标签: vb.net hyperlink webpage

我开始编码,我在我正在创建的VB.NET应用程序中遇到了问题。

Webbrowser1中加载新网页时,我希望我的代码打开一个链接,在您自己的网络浏览器中执行,即chrome,Firefox。

我将如何做到这一点?

1 个答案:

答案 0 :(得分:0)

Public Class Form1
    Dim FirstRun As Boolean = True
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.Navigate("http://stackoverflow.com")
    End Sub
    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        If Not FirstRun Then Process.Start("http://stackoverflow.com")
        FirstRun = False
    End Sub
End Class