Jump to content

How to make it work automatically using my code ?

- - - - -

  • Please log in to reply
No replies to this topic

#1
polas

polas

    Newbie

  • Members
  • Pip
  • 5 posts
Hello I'm Polll.
I have problem with my code.
So I thought maybe you can help me to solve this problem.
I can't find on google that answer how to make it work automatically.

My question is how to make a program to search and collect all the links from Google i know how.
The problem how to make work using my code automatically.
Example: 1,2,3,4,5,6,7,8,9 next and so on.
How can I do that using timer, multithread or with backgroundworker maybe?

Here is my code.

  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)

  end Sub


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 I HtmlElement In WebBrowser1.Document.Links

                 try

                     IF NOT ClientControl.GetAttribute ("href"). Contains (Google) And ClientControl.GetAttribute ("href"). Contains ("http") Then

                         ListBox1.Items.Add (ClientControl.GetAttribute ('href'))

                     end If

                 Catch ex As Exception


                 end Try


             Next

         end If


   ListBox1.Sorted = True


         ListBox1.Refresh ()

         Dim index As Integer

         Dim a As Integer = itemcount 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

Thanks in advance.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users