Nope. It just disables the timer event. It will fire at odd times once it's re-enabled because
it's not being reset to zero.
Nope. It just disables the timer event. It will fire at odd times once it's re-enabled because
it's not being reset to zero.
Timer - as in timer that counts from 0 to 86400 during a day?
Or..
Timer - as in timer that will fire off an event every X milliseconds?
If it's the 1st one, I thought that one was driven by the 8259(or whatever it's equivalent is these days), a BIOS sort of thing that can't be reset with doing a 2 fingered salute (CMOS jumper reset)
Last edited by skimask; - 22nd July 2008 at 00:18. Reason: Had my numbers (1st and 2nd) backwards
I have a VB form with multiple buttons. When a user presses a button, it prints the button
value to a text box. Button values range from 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
The text box needs to be cleared after a timeout period of around 15 seconds, but only if
no other buttons are pressed during this time interval.
I.E. the user can enter 1, and it clears in the text box after 15 seconds. But if the user
enters 1, 2, 3, then the timer interval should be reset to zero after button #3 is pressed
so 123 in the text box is cleared in 15 seconds.
Bruce -
Disable the timer, then set the interval property back to whatever you need.
Wisdom is knowing what path to take next... Integrity is taking it.
Ryan Miller
I feel, it can't be done with the timer control as it is. Rewriting the interval does not reset the internal counting of the timer. I could suggest you look at this construct if you could use it.
This uses the inbuilt function 'Timer' to wait while the interval has not expired. This function is useful as an in-line timer.Code:sub Wait(interval as single) Dim x as single x = timer+interval while x > timer: doevents:wend end sub
Hope this helps.
Thanks guys, but neither of these approaches will work. Stopping & resetting the interval is
a no go, and a sub or proceedure that blocks button clicks isn't an option.
Hi Bruce,
Try disabling the Timer then set the interval to 0 and then set it back to whatever interval you want before enabling it again.
From this page on MSDN:
So if you first set the interval to 0 and then reset it to whatever it should do what you want, right?The Timer control's Enabled property determines whether the control responds to the passage of time. Set Enabled to False to turn a Timer control off, and to True to turn it on. When a Timer control is enabled, its countdown always starts from the value of its Interval property setting
/Henrik.
Bookmarks