vb.net webbrowser 得到所有超链接
就是webbrowser中我想获得他所访问的网页的所有超链接也就是<a>中的链接究竟如何实现注意是VB.NET这个问题解决啦我现在想问下~我在VB.NET中执行“Inet...
就是 webbrowser 中 我想获得 他所访问的网页的 所有超链接 也就是<a>中的链接 究竟如何实现 注意是 VB.NET
这个问题解决啦 我现在想问下~ 我在VB.NET 中 执行 “Inet1.Execute, "CLOSE" ”
出错 请问怎么办 错误是:
错误 1 没有可访问的“Execute”接受此数目的参数,因此重载决策失败。 展开
这个问题解决啦 我现在想问下~ 我在VB.NET 中 执行 “Inet1.Execute, "CLOSE" ”
出错 请问怎么办 错误是:
错误 1 没有可访问的“Execute”接受此数目的参数,因此重载决策失败。 展开
展开全部
先设置WebBroswer1.Url = "http://www.baidu.com/";
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim broswer As WebBrowser = CType(sender, WebBrowser)
Dim doc As HtmlDocument = broswer.Document
Dim allHyperlinks As HtmlElementCollection = doc.GetElementsByTagName("A")
Dim hyperlink As HtmlElement = Nothing
Dim href As String = String.Empty
For i = 0 To allHyperlinks.Count
hyperlink = allHyperlinks(i)
href = hyperlink.GetAttribute("href")
Me.ComboBox1.Items.Add(href)
Me.ComboBox1.SelectedIndex = 0
Next
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim broswer As WebBrowser = CType(sender, WebBrowser)
Dim doc As HtmlDocument = broswer.Document
Dim allHyperlinks As HtmlElementCollection = doc.GetElementsByTagName("A")
Dim hyperlink As HtmlElement = Nothing
Dim href As String = String.Empty
For i = 0 To allHyperlinks.Count
hyperlink = allHyperlinks(i)
href = hyperlink.GetAttribute("href")
Me.ComboBox1.Items.Add(href)
Me.ComboBox1.SelectedIndex = 0
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询