Looping question

  • Thread starter Thread starter Nikolay Petrov
  • Start date Start date
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
 
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
 
Back
Top