1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Rep Power

    [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
    End If
    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 04:32 AM. Reason: Fixed with other solution, used Threading.Thread.Sleep(5000)

IMN logo majestic logo threadwatch logo seochat tools logo