i have 2 button(Start & Stop) and i want a timekeeper.Please help me.thanks :confused:
Printable View
i have 2 button(Start & Stop) and i want a timekeeper.Please help me.thanks :confused:
If you are using .NET 2.0 (please specify in future) then you have the Stopwatch class available to you. If you're using an earlier version then I've posted a simple Stopwatch class in the C# CodeBank.
thanks brother.now,i want a digital clock but pending.please help me
use a Timer and 3 labels (or one label if you know how to do it)
You still haven't specified which version you're using.
As has been said, use a Windows.Forms.Timer and in its Tick event you update the Text in a Label. If you want it to look even more like a digital clock you can use the LedLabel control in the ElementsEx library in my signature.
can you demo ?i using vs2005
Add a Timer to your form in the design Window and set its Interval property to the number of milliseconds you want between updates. Also set its Enabled property to False. Double-click it to create a Tick event handler. In that event handler place the code to set the Label's Text property to whatever it is you want displayed. Whenever you start the StopWatch you call the Start method of the Timer and whenever you stop the StopWatch you call the Stop method of the Timer.
That's not a demo, this is "explanation" :p ;)Quote:
Originally Posted by jmcilhinney
That's quite true. How do you demo adding controls in the designer? I'm not going to create a project and post it. Following instructions takes more thought than copying and pasting code and I'm all for that. You learn much more by doing, even if you're doing what someone else tells you to.
this problem i had done but i want a stopwatch similar as game minesweeper of microsoft. :bigyello:
jmcilhinney could you also do what you described there in 1.1 Framework?
And I think jmcilhinney explains quite well. The help he has given to me, at first I thought why not create something and send it to me it might be easier, but following the instructions made me learn better. Keep it up and thanks :thumb: - Jennfer
Absolutely. In VS.NET 2003 you have the advantage that the Timers.Timer component is in the Toolbox by default. For this I'd be inclined to use the Timers.Timer over the Windows.Forms.Timer because if you clear the SynchronizingObject property of the Timers.Timer it will raise its Elapsed events in a worker thread. That means that your stopwatch display will not stutter if the UI thread is busy doing something.Quote:
Originally Posted by JenniferBabe