求助vb.net webbrowser获取所有网页链接
vb.net webbrowser获取所有网页链接
谢谢大家
[解决办法]
能把问题描述得详细一点么?
[解决办法]
先设置WebBroswer1.Url = "***";//你访问你网站地址
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