問題得到鏈接是多線程是不是正從webbrowser1.document.links鏈接正常工作。我怎麼解決這個問題?多線程對於來自Webbrowser1.Document
Public Class Form1
Dim thread1 As System.Threading.Thread
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
thread1 = New System.Threading.Thread(AddressOf GetLinks)
thread1.Start()
End Sub
Private Sub GetLinks()
For i As Integer = 0 To WebBrowser1.Document.Links.Count - 1
If TextBox1.Text.Length > 0 Then
TextBox1.Text += Environment.NewLine & WebBrowser1.Document.Links(i).ToString
Else
TextBox1.Text = WebBrowser1.Document.Links(i).ToString
End If
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("www.google.com")
Me.CheckForIllegalCrossThreadCalls = False
End Sub
End Class
你得到一個錯誤?或沒有獲取數據?或者文本框沒有更新? –
你嘗試在線程中運行它,而不是開始一個新的線程測試的代碼?換句話說,就是在GetLinks的問題,或者甚至沒有被執行Getlinks? –