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:
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click WebBrowser1.Navigate("http://www.website.com") End If Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted Dim q As String = WebBrowser1.Document.GetElementById("123").InnerText txtOne.Text = (q) 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


Reply With Quote




