dcsimg
Results 1 to 3 of 3

Thread: pause unpause and go further and stop application job after button stop

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2011
    Posts
    137

    pause unpause and go further and stop application job after button stop

    Code:
    dim i as integer = 0
    do while (i <10)
    Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("google.com/search?num=100&q=" & TextBox1.Text & "&start=" & i)
            Dim response As System.Net.HttpWebResponse = request.GetResponse
            Dim stream As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
            Dim page As String = stream.ReadToEnd
            Dim regexobj As Regex = New Regex("http://([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\\^\\*\(\)_\-\=\+\\\/\?\.\:\;\,]*)?", RegexOptions.IgnoreCase Or RegexOptions.Compiled)
            Dim matches As MatchCollection = regexobj.Matches(page)
            For Each item As Match In matches
                If Not item.Value.Contains("google") And Not item.Value.Contains("wj") And Not item.Value.Contains("png") And Not item.Value.Contains("jpg") And Not item.Value.Contains("gif") And Not item.Value.Contains("ico") Then
                    ListBox1.Items.Add(item.Value)
                End If
            Next
            i = i + 10
            loop 
            Label1.Text = ListBox1.Items.Count
    it's very slow thinking and freezing the program.

    Code:
    do while (i<=10) how can i fix and scrape more then 10 urls ? I set 100 but it shows like 300 urls not 100 results it's faking and that very crazy me besides it's thiking very slow.
    ListBox1.Items.Add(item.Value)
    next
    i=i+10
    loop
    Pause and unpause a Do while loop and continue further and then pause about 5,10 seconds and go further after i click button stop it should stop all processes vb.net
    How can i do that using the code above ?

    I found an examples how to do that but the problem i need for vb.net but this is for vb6

    What i want just when i click the button go it starts scraping urls after 100,200 urls it should pause for about 5,10 seconds and go further for more urls after all i click the button stop it should stop all processes and list all urls in listbox using the above code i only need how to pause unpause and go further and stop all process using similar to Do while loop.

    Thanks very much.

  2. #2
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,329

    Re: pause unpause and go further and stop application job after button stop

    Don't you agree that maybe the HttpWebRequest class is beyond your level before you even understanding threading? Did you write that regex?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2011
    Posts
    137

    Re: pause unpause and go further and stop application job after button stop

    No i found it on google.
    I really need help i almost finished my project creating just this one left unsolved.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width