Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

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
0
janhoye
Asked:
janhoye
2 Solutions
 
arif_eqbalCommented:
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
 
Bob LearnedCommented:
Or use the DocumentComplete event from the web browser control.

Bob
0
 
lojk.Net and Infrastructure ConsultantCommented:
dont forget than you probably need an application.doevents within your loop....
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now