Results 1 to 12 of 12

Thread: Webbrowser Document Complete

Threaded View

  1. #1

    Thread Starter
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,828

    Resolved Webbrowser Document Complete

    I'm using a webbrowser control to pull some information from a website. It works fine.

    I load the web page when the user clicks a button and then I pull the information from the site when the page completely loads. I have this bit of code in the DocumentComplete event.

    I am doing this for two different websites. So, my code as it is, looks something likes this:
    vb.net Code:
    1. Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
    2.      WebBrowser1.Navigate("http://www.website.com")
    3.         End If
    4.  
    5. Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    6.  
    7.             Dim q As String = WebBrowser1.Document.GetElementById("123").InnerText
    8.             txtOne.Text = (q)
    9.         End If

    If I add a second Navigate to the same WebBrowser control, and then add another Document.GetElementById line, using different variables, it doesn't work.

    Its obvious that it loads both sites and then it finishes. So, it never has time to finish the first load and then pull the info into the text box.

    Is there a way to do this? To load the first site, pull the info, load the second site, then pull the info from there?

    Thanks
    Last edited by weirddemon; May 13th, 2009 at 08:59 PM.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

Posting Permissions

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



Click Here to Expand Forum to Full Width