Looping question

N

Nikolay Petrov

I am using AxSHDocVw.AxWebBrowser in my WinForms app.
I have an array of URLs as string
I use the following loop to navigate to these URLs and then in
DocumentComplete Event of AxWebBrowser I proccess the opened page.
I do this by the fallowing loop.

Dim Browser as New AxSHDocVw.AxWebBrowser
Dim i as Integer
for i = 0 to arrURLs.GetUpperbound(0)
Browser.Navigate(arrURLs(i))
next

The problem is that it only executes for the last element in the array.
My questions are:
1. How to make the next loop iteration to wait for the browser to load the
page, them the event hadler to do it's job and after then to execute the
next loop?
2. Why it only goes to the Last element in the array? (I guess, because it
is the last url passed to the browser, others just goes too fast)


TIA
 
L

Larry Serflaten

Nikolay Petrov said:
I am using AxSHDocVw.AxWebBrowser in my WinForms app.
I have an array of URLs as string
I use the following loop to navigate to these URLs and then in
DocumentComplete Event of AxWebBrowser I proccess the opened page.
I do this by the fallowing loop.

Dim Browser as New AxSHDocVw.AxWebBrowser
Dim i as Integer
for i = 0 to arrURLs.GetUpperbound(0)
Browser.Navigate(arrURLs(i))
next

The problem is that it only executes for the last element in the array.
My questions are:
1. How to make the next loop iteration to wait for the browser to load the
page, them the event hadler to do it's job and after then to execute the
next loop?
2. Why it only goes to the Last element in the array? (I guess, because it
is the last url passed to the browser, others just goes too fast)

Too fast, correct.

So the last line of your DocumentComplete event should be a call to
load up the next page in a list....

LFS
 

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