I know it sounds stupid, but I've tried everything to stop a timer, but the timer won't stop. I'm working on a game and i would appreciate if someone could tell me how to stop a timer.
See Question&Answers more detail:osI know it sounds stupid, but I've tried everything to stop a timer, but the timer won't stop. I'm working on a game and i would appreciate if someone could tell me how to stop a timer.
See Question&Answers more detail:osIf you are using System.Timers.Timer
stopping is performed by one of the options:
//options 1
timer.Enabled = false
//option 2
timer.Stop()
if you are using System.Threading.Timer
, use this method
timer.Change(Timeout.Infinite , Timeout.Infinite)
if you are using System.Windows.Forms.Timer
, use this method
timer.Stop();