Board index » Visual Studio » performing action repeatedly after a certain interval
|
dartmoor
|
|
dartmoor
|
performing action repeatedly after a certain interval
Visual Studio305
hello there need to create an application that checks for a condition every 5 minutes and performs a certain action depending on whether the condition was met or not. what is the best way to do that? using "system.Threading.Thread.Sleep (5000)" is the option I have in mind now as I believe using a Do while loop will be quite resource intensive. any ideas? Regards Sameh - |
| Michael
Registered User |
Thu Oct 14 12:04:18 CDT 2004
Re:performing action repeatedly after a certain interval
Why not user the timer control?
"Sameh Ahmed" <essoplus@hotmail.com>wrote in message Quotehello there - |
| Imran
Registered User |
Thu Oct 14 12:12:55 CDT 2004
Re:performing action repeatedly after a certain interval
Take a look at timers. There are 3 timers in the .NET framework. The ones
suitable in your case would be System.Windows.Forms.Timer System.Timers.Timer. For the Forms timer, check your condition in the Tick Event of the timer and for Timers timer, you can check your condition in the Elapsed Event. Examples can be found in the MSDN documentation - System.Windows.Forms.Timer: http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/library/en-us/cpref/html/frlrfSystemWindowsFormsTimerClassTopic.asp System.Timers.Timer: http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/library/en-us/cpref/html/frlrfsystemtimerstimerclasstopic.asp hope that helps.. Imran. "Sameh Ahmed" <essoplus@hotmail.com>wrote in message Quotehello there - |
| Sameh
Registered User |
Thu Oct 14 12:59:54 CDT 2004
Re:performing action repeatedly after a certain interval
thanks people
that was more then enough:) "Imran Koradia" <nospam@microsoft.com>wrote in message QuoteTake a look at timers. There are 3 timers in the .NET framework. The ones - |
