url navigation in a while loop doesnt work

D

Danny

i am trying to load different pages and scanning some words out of the pages.
But my problem is that the readystate is never 4 except when i show a msgbox

example:

axWebbrowser.Navigate(sUrlPart1+ sUrl)

while axWebbrowser.Readystate <> SHDocVm.tagReEADYSTATE_COMPLETE
iReadystate = axWebbrowser.Readystate
end while
' this example will keep looping becuase Readystate stays 1

But when i do this:
axWebbrowser.Navigate(sUrlPart1+ sUrl)

while axWebbrowser.Readystate <> SHDocVm.tagReEADYSTATE_COMPLETE
MsgBox(axWebbrowser.Readystate)
iReadystate = axWebbrowser.Readystate
end while

The program works only problem are the msgbox popups.
I tried also to put a thread.sleep(10000) in the loop but did doesnt work either.
So whats going on here?
And how do i solve this?
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Danny) scripsit:
i am trying to load different pages and scanning some words out of the pages.
But my problem is that the readystate is never 4 except when i show a msgbox

example:

axWebbrowser.Navigate(sUrlPart1+ sUrl)

Use 'Navigate2' instead and add your other code to the webbrowser's
'DocumentComplete' event.
 
C

Cor Ligthert

Danny,

Maybe this helps you,
\\\ eDocuments is an arraylist
Private Sub AxWebBrowser1_DocumentComplete(ByVal sender _
As System.Object, _ ByVal e As
AxSHDocVw.DWebBrowserEvents2 _ DocumentCompleteEvent) _
Handles AxWebBrowser1.DocumentComplete
Dim wb As SHDocVw.WebBrowser = _
DirectCast(e.pDisp, SHDocVw.WebBrowser)
eDocuments.Add(wb.Document)
End Sub

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top