'Button1
Dim ex1 As New Threading.Thread(AddressOf ex1_sub) Dim ex2 As New Threading.Thread(AddressOf ex2_sub) ex1.Start() ex2.Start() 'End Sub Sub ex1_sub() Dim result_ex1 As IWebResult Dim client_ex1 As New GwebSearchClient("http://www.google.com") Dim results_ex1 As IList(Of IWebResult) = client_ex1.Search("love", 2) For Each result_ex1 In results_ex1 MsgBox(result_ex1.Title) Next End Sub Sub ex2_sub() Dim result_ex2 As IWebResult Dim client_ex2 As New GwebSearchClient("http://www.google.com") Dim results_ex2 As IList(Of IWebResult) = client_ex2.Search("hate", 2) For Each result_ex2 In results_ex2 MsgBox(result_ex2.Title) Next End Sub
It points either to results_ex2 or results_ex1 and tells me Object reference not set to an instance of an object. How could I fix that ?