我正在尝试按标签名称加载所有HTML元素的内部文本,这个工作到目前为止但我希望它只显示OuterHtml包含某个字符串的那些,我使用下面的代码:
Public Class web
Private Sub browse_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles browse.DocumentCompleted
Dim elements As HtmlElementCollection = browse.Document.GetElementsByTagName("a")
Form1.o.Text = Form1.o.Text + "Retrieving Members from: " + browse.Url.ToString + "." + vbNewLine
For Each CurElement As HtmlElement In elements
If (CurElement.InnerHtml.Contains("http://www.programmingguild.com/forum/member.php?action=profile&uid=")) Then
Form1.s = CurElement.InnerText
Form1.o.Text = Form1.o.Text + Form1.s + vbNewLine
End If
Next
End Sub
End Class
我收到错误:对象引用未设置为对象的实例。
请帮助,谢谢。