Question Creating a Timer that at a specific values changes a label

JaneAbrams

New member
Joined
Nov 22, 2012
Messages
1
Programming Experience
1-3
I am new to C#, and I have searched I but didn't find a simple solution to my problem.
I am creating a Windows form application.
After the start button is clicked, it counts every millisecond and when it reaches specific values from an array changes a label.
How can milliseconds be counted?
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,150
Location
Sydney, Australia
Programming Experience
10+
It depends exactly what you mean by counting milliseconds. Using a Stopwatch you can determine at any point how much time has passed since you started it, just like a real stopwatch. If you want to make something happen after a specific amount of time then that would be a Timer. With a Timer set the Interval to a specific number of milliseconds and it will then raise its Tick event each time that amount of time has passed, much like an alarm clock.
 
Top Bottom