473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

performing action repeatedly after a certain interval

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
Nov 21 '05 #1
3 1589
Why not user the timer control?

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:e9******************@TK2MSFTNGP10.phx.gbl...
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


Nov 21 '05 #2
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/de...ClassTopic.asp

System.Timers.Timer:
http://msdn.microsoft.com/library/de...classtopic.asp

hope that helps..
Imran.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:e9******************@TK2MSFTNGP10.phx.gbl...
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

Nov 21 '05 #3
thanks people
that was more then enough:)

"Imran Koradia" <no****@microsoft.com> wrote in message
news:eg*************@TK2MSFTNGP12.phx.gbl...
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/de...ClassTopic.asp
System.Timers.Timer:
http://msdn.microsoft.com/library/de...classtopic.asp
hope that helps..
Imran.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:e9******************@TK2MSFTNGP10.phx.gbl...
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


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Michael Levin | last post by:
I've got the following problem. I'm a biologist and I have a device at work which monitors my frog habitat. The device has a bunch of sensors, and runs an embedded html server with some java...
1
by: nik | last post by:
hi, my C++ app has embedded the interpreter and calls a python script everytime it creates a certain data structure. This allows the user to put the structure into a database or files or...
1
by: Smythe32 | last post by:
If anyone could help, I would appreciate it. I have a table as listed below. I need to check for duplicates by the OrderItem field and if there are duplicates, it then needs to keep the...
4
by: Eranga | last post by:
I want to add a program to windows which will run at a specified time period which may be changed by the administrator.What I plan to do is start the program at windows startup and then within that...
1
by: Adam Atlas | last post by:
(Apache/2.0.55, PHP/4.4.1) I am using an "Action" directive in my Apache configuration to map a certain file type (by means of AddType and AddHandler) to a PHP script. I wasn't sure if this would...
4
by: joaotsetsemoita | last post by:
hello everyone. Im trying to time out a loot after a certain time. Probably 5 to 10 minutes. I have the following function Private Sub processFileCreation(ByVal source As Object, ByVal e As...
1
by: mwhitaker | last post by:
I'm creating a interactive map that guests will be able to use for our property. I have many different pages and movie clips. The question I have is if a guest walks up to the map and goes to a...
0
by: devidevi | last post by:
hello sir, i'm doing a project in Mobile Adhoc network in ns2 simulator i have to perform routing with AODV.. my problem is i have to disable certain nodes ( in a 20 node topology) from...
1
by: projjwal | last post by:
Hi Everyone, I need to fire a procedure which will upade a table after a certain interval.can anyone tell me..how to fire a store procedure after some some fixed days?
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.