Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have one button start in my form and i want to start the time on click of button like 00:01 and that time will stop on click of stop button..
how to do this in C#,WPf and VS 2008..is there any timer control..
Posted

Add Timer Component from ToolBox to your project and for
Start Button :
timer1.Enabled=true;

Stop Button :
timer1.Enabled=false;

Could help you in C#
 
Share this answer
 
v2
Yes:
Timer class[^] (System.Timers)
or:
Timer Class[^] (System.Threading)
or:
System.Windows.Forms.Timer[^]
Or for WPF:

Timer in WPF
[^]

There is also the Stopwatch class[^] if you need better accuracy

[edit]System.Windows.Forms.Timer added by popular request! Thanks SA... - OriginalGriff[/edit]
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 29-Apr-11 3:50am    
Ha! You cheated! You skipped System.Windows.Forms.Timer! I know why: you just hate this crap. I don't blame you. Well, a stopwatch cannot be used like "Timer", but good to mention. My 5.
--SA
OriginalGriff 29-Apr-11 3:54am    
Fixed! It's too early in the morning to be *completely* accurate! :laugh:
Sergey Alexandrovich Kryukov 29-Apr-11 4:03am    
Sure. I would call this a Freudian slip :-)
--SA
Sergey Alexandrovich Kryukov 29-Apr-11 3:52am    
Wait a minute... OP's text is pretty bad but it looks he only needs a Stopwatch, not a timer...
Vishal, am I right?
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900