RE: how to make it work automatically ? 07-21-2011, 11:14 PM
#9
Not working just after 2 minutes it show only blank google page 
I did everything but no luck.
It doesn't even extract links.
Just stop for 2 minutes and show google page.
no error but and not working.
I do not understand how to chnage i'm new so i see this asyncworker first time so how to change it ?
Allright what em i doing wrong can you fix this here is my code.
Maybe now you will what is the problem with code or i'm doing something wrong.
Really thank you in advance.

I did everything but no luck.
It doesn't even extract links.
Just stop for 2 minutes and show google page.
no error but and not working.
I do not understand how to chnage i'm new so i see this asyncworker first time so how to change it ?

Allright what em i doing wrong can you fix this here is my code.
Maybe now you will what is the problem with code or i'm doing something wrong.
Really thank you in advance.
Code:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If (WebBrowser1.ReadyState = WebBrowserReadyState.Complete) Then
For Each ClientControl As HtmlElement In WebBrowser1.Document.Links
If Not ClientControl.GetAttribute("href").Contains("google") And ClientControl.GetAttribute("href").Contains("http") And ClientControl.GetAttribute("href").Contains("http") Then
ListBox1.Items.Add(ClientControl.GetAttribute("href"))
End If
Next
End If
'Remove dups
ListBox1.Sorted = True
ListBox1.Refresh()
Dim index As Integer
Dim itemcount As Integer = ListBox1.Items.Count
If itemcount > 1 Then
Dim lastitem As String = ListBox1.Items(itemcount - 1)
For index = itemcount - 2 To 0 Step -1
If ListBox1.Items(index) = lastitem Then
ListBox1.Items.RemoveAt(index)
Else
lastitem = ListBox1.Items(index)
End If
Next
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate("http://www.google.lt/search?num=100&q = " & ComboBox1.Text)
Dim parameter As String = ComboBox1.Text
BackgroundWorker1.RunWorkerAsync(parameter)
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
If (ListBox1.SelectedIndex <> -1) Then _
Process.Start(ListBox1.SelectedItem.ToString())
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Enter Then
WebBrowser1.Navigate(ComboBox1.Text)
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.Focus()
SendKeys.Send("^f")
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim path As String = DirectCast(e.Argument, String)
For i = 0 To 100
WebBrowser1.Navigate("http://www.google.lt/search?num=" & i & "&q = " & path)
Threading.Thread.Sleep(200)
BackgroundWorker1.ReportProgress(i)
Next
End Sub
Private Sub ZoomToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZoomToolStripMenuItem.Click
WebBrowser1.Document.ForeColor = Color.Chocolate
End Sub
![[+]](https://sinister.li/images/modern/collapse_collapsed.png)