I have a simple timer in .net 4.0, the interval is set to 1000 (= 1 second) and enabled = true. To start the timer I use .Start(). Everything works fine so far.
Then in the event of the timer I got this :
private void MyTimerEvent()
{
myTimer.Stop();
myTimer.Start();
//Some other work is done not related to the timer
}
The problem is that as soon as the timer event have been runned once it will stop throwing the event and its seems like it is set to enabled = false even after the myTimer.Start(); sometimes. But I am not setting the enabled = false at all?
What am I doing wrong?
Edit : System.Windows.Forms.Timer is the one I use.
If you call
Stopon aForms.Timerit simply does anEnabled=False. Same withStart. If your Timer isenabledthere is no need to callStartbecause the timer is running already.You can check yourself with Reflector et al: