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
janhoyeAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
Or use the DocumentComplete event from the web browser control.

Bob
0
 
arif_eqbalConnect With a Mentor Commented:
If I understand it right, you will have the MS Web Browser component and you'd try navigaing to some URL in a Loop so that it updates some data every time

If yes then instead of the For Loop try using the Navigate_Complete event
this event is fired when your Web Browser control is done updating the things and is free now, so in there you can write the code to go and update new data or whatever
0
 
lojk.Net and Infrastructure ConsultantCommented:
dont forget than you probably need an application.doevents within your loop....
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
janhoyeAuthor Commented:
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!
0
 
Bob LearnedCommented:
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
0
 
janhoyeAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.