简体   繁体   中英

countdown timer

trying to do a countdown timer in C# on micrsoft visual studio minimum value of 10seconds, maximum of 2hours need a display when timer runs out how do i implement this? thanks

Use System.Threading.Timer wherein you can specify how much time should pass until the timer fires, and what code to execute when the timer does fire.

You can also look at the System.Windows.Forms.Timer .

For a comparison of all the timer-like classes in .NET, check out Comparing the Timer Classes in the .NET Framework .

Use timers from System.Timer or System.Threading .Timer depends upon your needs. and execute your code in each interval.

have a look at

http://msdn.microsoft.com/en-us/library/system.timers.timer.aspx

and

http://msdn.microsoft.com/en-us/library/system.threading.timer.aspx

if its a simple winforms app like u mentioned its a countdown app consider Forms.Timer its easier to implement. Just drag and drop the control from toolbox and perform countdown in Tick Event. have a look for it here:

http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM