vb.net WebBrowser链接到默认Web浏览器

时间:2011-03-09 23:04:51

标签: vb.net browser

有没有办法检测一个人点击WebBrowser1里面的链接,然后我就可以了

Process.Start(TheURL)

然后将操作返回为false,这样它就不会单击webbrowser对象中的链接而只是单击该过程。

1 个答案:

答案 0 :(得分:1)

这里你去:

private void WebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
  {  
        e.Cancel = true; // Cancel the event to avoid default behavior
        System.Diagnostics.Process.Start(e.Url.ToString()); // Open the link in the default browser
  }
编辑:嗯,我有几分钟。在这里,你再来一次:

Private Sub WebBrowser1_Navigating(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
  e.Cancel = True 'Cancel the event to avoid default behavior
  System.Diagnostics.Process.Start(e.Url.ToString()) 'Open the link in the default browser
End Sub