如何让它在vb.net中自动运行?

时间:2011-07-21 14:46:23

标签: vb.net

你知道怎么用这段代码来做背景工作吗?

请求将是我从后台工作人员退出谷歌,如果是这样,可以从谷歌分页收集链接。

不是标签或我是如何新的。 我只是想要转到下一页,如1,2,3,4,5,6,7,8,9等单击按钮并使其自行运行,并通过所有页面与后台工作人员或计时器或如何让它自动工作,因为我说我是新的。 像谷歌一样有分页。 它只通过一个页面并停在第一个数字上,不要移动 远。

谢谢。

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
                 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

   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)
         BackgroundWorker1.RunWorkerAsync ()
     end Sub

Private Sub BackgroundWorker1_DoWork (ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
         For i = 0 to 100
             Threading.Thread.Sleep (200)
             BackgroundWorker1.ReportProgress (i)
         Next

     end Sub

     Private Sub BackgroundWorker1_ProgressChanged (ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
         Label1.Text = e.ProgressPercentage
     end Sub

如果不明白我的意思,那么这里就是我想要的例子。 http://s2.postimage.org/a82mtrifh/i_need_this_to_go_far_through_all_pages_automati.png

1 个答案:

答案 0 :(得分:1)

如果你查看了Google网址,就会看到有start=个查询

您可以通过修改此内容直接转到所需页面:(假设每页10个结果)

第1页

http://www.google.co.uk/#q=vb.net+book&start=0

第2页

http://www.google.co.uk/#q=vb.net+book&start=10

第3页

http://www.google.co.uk/#q=vb.net+book&start=20