Answered by:
restart vb timer

Question
-
how can i resart a vb timerWednesday, June 1, 2016 3:16 PM
Answers
-
There are 4 actual timers:
- dispatcher timer
- windows forms timer
- system time
- threading timer
and some call even a stopwatch a timer.
Maybe you understand that your question is more a problem for us than probably for you.
Success
Cor- Proposed as answer by Albert_Zhang Sunday, June 12, 2016 2:44 AM
- Marked as answer by Herro wongMicrosoft contingent staff Wednesday, June 15, 2016 1:57 AM
Wednesday, June 1, 2016 3:46 PM
All replies
-
Timer1.Start or whatever the Timers name is.
La vida loca
Wednesday, June 1, 2016 3:17 PM -
timer1.start if i click the botton i creat for timer1.start it will continue from the number it stop
so i want to creat a button to reset/restart the timmer i program\
Wednesday, June 1, 2016 3:20 PM -
Timer1.Restart.
Or: Timer1.Stop, Timer1.Reset, Timer1.Start
Reed Kimble - "When you do things right, people won't be sure you've done anything at all"
Wednesday, June 1, 2016 3:39 PM -
timer1.start if i click the botton i creat for timer1.start it will continue from the number it stop
so i want to creat a button to reset/restart the timmer i program\
You could also use the stopwatch which sounds more like what you want?- Proposed as answer by Albert_Zhang Sunday, June 12, 2016 2:44 AM
Wednesday, June 1, 2016 3:44 PM -
There are 4 actual timers:
- dispatcher timer
- windows forms timer
- system time
- threading timer
and some call even a stopwatch a timer.
Maybe you understand that your question is more a problem for us than probably for you.
Success
Cor- Proposed as answer by Albert_Zhang Sunday, June 12, 2016 2:44 AM
- Marked as answer by Herro wongMicrosoft contingent staff Wednesday, June 15, 2016 1:57 AM
Wednesday, June 1, 2016 3:46 PM -
There are 4 actual timers:
- dispatcher timer
- windows forms timer
- system time
- threading timer
and some call even a stopwatch a timer.
Maybe you understand that your question is more a problem for us than probably for you.
Success
Cor
Good catch. :) I was obviously thinking of Stopwatch.Reed Kimble - "When you do things right, people won't be sure you've done anything at all"
Wednesday, June 1, 2016 3:51 PM -
timer1.start if i click the botton i creat for timer1.start it will continue from the number it stop
so i want to creat a button to reset/restart the timmer i program\
You could also use the stopwatch which sounds more like what you want?haha its OK to say "hey dumb-dumb, that's code for a stopwatch" :)
(well, I guess its not OK to include the "dumb-dumb" part, even if I deserve it) ;)
Reed Kimble - "When you do things right, people won't be sure you've done anything at all"
Wednesday, June 1, 2016 3:54 PM -
timer1.start if i click the botton i creat for timer1.start it will continue from the number it stop
so i want to creat a button to reset/restart the timmer i program\
I'm guessing that you have the timer set up as a "one-shot" timer, like this?
Option Strict On Option Explicit On Option Infer Off Public Class Form1 Private WithEvents tmr As Timer Private Sub Form1_Load(sender As System.Object, _ e As System.EventArgs) _ Handles MyBase.Load tmr = New Timer _ With {.Interval = 1000, _ .Enabled = True} End Sub Private Sub _ tmr_Tick(sender As Object, _ e As System.EventArgs) _ Handles tmr.Tick tmr.Enabled = False ' Rest of your code here End Sub End Class
In that one, at the end of one second, the .Tick event is raised and immediately the timer is disabled (so it stops there).
If that's what you have then setting .Enabled = True will start it over again.
Is that what you have or am I missing it?
In the middle of difficulty ... lies opportunity. -- Albert Einstein
- Edited by Frank L. Smith Wednesday, June 1, 2016 4:12 PM ...typo
Wednesday, June 1, 2016 4:11 PM -
timer1.start if i click the botton i creat for timer1.start it will continue from the number it stop
so i want to creat a button to reset/restart the timmer i program\
Well I suppose the number it stop has something to do with a variable in the Timers code. I suppose that would be a global variable. Therefore reset the global variable back to whatever it should be reset to.
Other than that you either need to explain better or display your code so we can see what you are refering to. And if you are going to display your code please insert it into a Code Block in your post where you want to display it. Insert Code Block is to the right of the letters HTML in a post you are editing in the menu strip at the top of the window.
La vida loca
Wednesday, June 1, 2016 9:23 PM -
I got around this by using a timer set to 1 second intervals, for each time the timer fired I incremented a public counter which I reset to 0 when as a form of reset. In my program I performed my action when my public counter was greater than maxcount. Just an alternative solution as I hit the same problem. :)
Simon
Monday, October 21, 2019 11:19 AM