[RESOLVED] Wait for webbrowser finish navigate
Is there any little piece of programming to get a process halt until the webbrowser is finished navigating and the control WebBrowser1 is accessible.
My application starts with the webbrowser navigate to a specific url. Then I can manually use a Command1 to copy text from my webbrowser, as I wait to see if the browser has finished.
But I want the program itself to wait for it, indicating the browser is ready and then carry on with he rest of the program, without any Command button pressed...
Is that possible ?
/Kalle
Re: Wait for webbrowser finish navigate
Try using the WebBrowser1_NavigateComplete2 event.
Re: Wait for webbrowser finish navigate
there is a downloadcomplete event on the webrowser control. maybe if u call the button_click event on that it might solve your problem
Re: Wait for webbrowser finish navigate
Re: Wait for webbrowser finish navigate
Well, thanks anyway, iPrank !
This little piece of code worked too fine.... The sub routine kept on and on and on, never stopped...
Found an other code, that keep the program waiting for the webbowser to finish:
Code:
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Do Until WebBrowser1.Busy = False
DoEvents
Sleep 800
Loop
/Kalle
Re: Wait for webbrowser finish navigate
Don't use sleep with interval 800ms. It may slowdown other events - like moving/painting the form - specially when net connection is slow.
Use ~25ms interval.
Re: Wait for webbrowser finish navigate
OK ! Thanks !
I've tried several different ms, but not as short as 25 ms. Maybe a reason for other difficulties that I recently wrote about.... (see an other issue...)
Re: Wait for webbrowser finish navigate
Seems you have it working now.
Ps, dont forget to Resolve your thread from the Thread Tools menu so others know its been solved. ;)
Re: Wait for webbrowser finish navigate
Yes ! I will resolve it as soon as I get the whole thing working...
Sorry that I've put it in two different threads, but both of them will be cleared (Resolved) when I'm finished...