countdown timer
trying to do a countdown timer in C# on micrsoft visual studio minimum value of 10seconds, maximum of 2hours need a displa开发者_如何学运维y 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
精彩评论