Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB App Code Running Faster then Web Page Im trying to autonavigate.

Status
Not open for further replies.

RookPSU

Programmer
Jan 9, 2003
20
US
I created a VB "screen scrape" application that programmatically navigates a website in effort to extract data from a page that is a few links deep. The problem is the code obviously runs 10 times faster then that browser so the app ends up running page 4 code on page 2 because the browser cant keep up. I tried using function with this code in it:

while webbrowser1.busy
do events
wend

I also threw a boolean in the document_complete and before_navigate subs to identify when the doc is loading and when it is finished but all to no avail. If I step through the program it works fine, but at normal speed it runs in total disarray. Any ideas??!?
 

Try something like this...
[tt]
Wait = False
WB.Navigate "your place"
Do While Wait = False
DoEvents
'I have even added a Sleep 1 in here
Loop
'do rest code
[/tt]

then in the document complete event set wait = true (of visa versa how ever!).

Good Luck

 
Try the INET control object in VB.

Dim webpage as new INET
Dim webPageHTML as string

webPageHTML = webpage.Open("URL")

Now you have the html stored as a string and you can parse through it.

you can't execute the next line of code until it has finished opening the page with the INET control.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top