Link to home
Start Free TrialLog in
Avatar of janhoye
janhoye

asked on

Timer/Timed Control While Loop

Hello all,

I have been trying to find a solution for this problem for few days now.

I was wondering if someone in here can lead me to a right direction where I can find a way to do a timed/timer controlled while loop.

I have a Microsoft Web Browser object inside a while loop that calls some site on my server to update data remotley. the problem is the while loop is going so much faster than the internet connection, so it wouldnt update all files.

I have looked into Thread.Sleep method, but it freezes everything.

Any help would be greatly appreciated.

thanks
SOLUTION
Avatar of arif_eqbal
arif_eqbal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
dont forget than you probably need an application.doevents within your loop....
Avatar of janhoye
janhoye

ASKER

thank you so much.

now, i read enough about NavigateComplete and DocumentComplete.

but i have another challenge. Is there any possible way to have the have a property like navigatecomplete for the webbrowser control?

Appreciate the help!
Pseudo code for my suggestion:

Put all the URLs into a queue object

DocumentComplete handler:

   Process the current HTML document
   If more URLs
      Navigate to the next URL from the queue

Bob
Avatar of janhoye

ASKER

Thank you both for the answer.

TheLearnedOne, the solution you gave me at the end actually worked like a charm.

I queued all the URLs into an array and loop through the array under the DocumentComplete event...

very very relieved now :)

thanks again,

mike