LzBy1

I'm stuck on some code right now trying to create a stop watch like timer. I want to display the elapsed time in a lable from the time the timer starts. I can get the time to update the lable.text on the timer_tick however I don't know how to show elapsed time. I admit I'm new and the solution should be rather simple, however I can't seem to solve this problem. Please help. Thank you.

Re: Visual Basic Express Edition How to Create a Stopwatch-like timer

ReneeC

 

Checkout the Stopwatch class.






Re: Visual Basic Express Edition How to Create a Stopwatch-like timer

nobugz

Expanding a bit on Renee's correct answer: use the timer you got now to update the label's Text property. Set it's Interval to 50msec to make it look smooth. Don't use it to measure time. Do that with the Stopwatch class. DateTime.Now and Environment.TickCount are also available to measure time but you'll need a subtraction.