August 14th, 2008, 05:16 AM
[VB.NET] Timer won't tick
In the top of my code I declare a timer:
In my load event I set some properties:
Private WithEvents changeTimer As New Timer
And in a thread that is called I do the following check:
changeTimer.Interval = 5000
changeTimer.Enabled = False
What just basicly is that when the timer isn't running yet make sure it starts running.
If Not changeTimer.Enabled Then
changeTimer.Enabled = True
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)