If one has a Timer that has an interval of 10000 = 10 Seconds, then another timer with a interval of 20 which must take timer 1's Interval subtract it from the Current Value eg 4000, how does one do this?
Printable View
If one has a Timer that has an interval of 10000 = 10 Seconds, then another timer with a interval of 20 which must take timer 1's Interval subtract it from the Current Value eg 4000, how does one do this?
The timer does not have any property which specifies the amount of time that has passed. What you can do instead, is to perform calculations. After every Timer2 tick, multiply the number of ticks that have occurred by 20, and subtract from 4000 * number of timer1 ticks.
The amount of ticks must be declared outside of the timer event too.. ;)
If you want elapsed time then the best thing to do is store the current time (Dim startTime As Date = Date.Now) in a variable when you start. You can then Subtract that variable from the current time later (Dim elapsedTime As TimeSpan = Date.Now.Subtract(startTime)).