Having a little problem with the windows form timer. Its a very basic question, but I've looked around and cannot seem to find the answer (I probably deserve a slap).
I need to be able to get the value of the timer, whether its elapsed time is greater than an interval of 500ms.
something like
Timer.Elapsed >= 500
Timer.Elapsed
isn't a property returning "the elapsed time" - it's an event you subscribe to. The idea is that the event fires every so often.
It's not really clear whether you even want a Timer
- perhaps System.Diagnostics.Stopwatch
is really what you're after?
var stopwatch = Stopwatch.StartNew();
// Do some work here
if (stopwatch.ElapsedMilliseconds >= 500)
{
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With