August 14th, 2008, 05:16 AM
Join Date: Jul 2008
Time spent in forums: 6 h 13 m 41 sec
Reputation Power: 0
[VB.NET] Timer won't tick
In the top of my code I declare a timer:
Private WithEvents changeTimer As New Timer
In my load event I set some properties:
changeTimer.Interval = 5000
changeTimer.Enabled = False
And in a thread that is called I do the following check:
If Not changeTimer.Enabled Then
changeTimer.Enabled = True
What just basicly is that when the timer isn't running yet make sure it starts running.
i'v added a breakpoint on the line "changeTimer.Start()" and one in the changeTimer.Tick event
The first breakpoint gets hit so the timer is started ( So it seems ).
But the breakpoint in the changeTimer.Tick event never gets hitted what just means the timer isn't running.
Why is this? What could be wrong? Has this something to do with the fact a Thread calls the timer to start?
Thanks in advance
Last edited by Ontani : August 14th, 2008 at 05:32 AM.
Reason: Fixed with other solution, used Threading.Thread.Sleep(5000)