Timer Enabled, Start, Stop

Can someone explain or link to an explaination of the difference between the Timer Enabled property and the Start, Stop methods? Ex: Aren't Timer.Enabled = False and Timer.Stop the same thing?
LVL 4
srcalcAsked:
Who is Participating?
 
DJ_Back-QConnect With a Mentor Commented:
Start will of course start the timer, and Stop will of course delete the timer.

If you set Timer.Enabled = True it will start the timer. The Timer.Start() basically enables the timer in the background.

If you set Timer.Disabled = True it will stop the timer but the one difference is that a Timer that has been disabled is subject to garbage collection. That means a timer that is disable can be destroyed.

I suggest that you always use Start and Stop
0
 
drichardsConnect With a Mentor Commented:
They are the same.  Here's what the doc says:

"Setting Enabled to true is the same as calling Start, while setting Enabled to false is the same as calling Stop."
0
 
srcalcAuthor Commented:
They are 100% exactly the same?
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
srcalcAuthor Commented:
Ok thanks!
0
 
drichardsCommented:
Actually, it appears to depend on what type of timer you mean.

System.Timers.Timer:
  Stop/Start and Enabled true/false are identical

System.Windows.Forms.Timer
  DJ_Back-Q's comments are true except that there is no Disabled.  It's Enabled = false.

System.Threading.Timer
  Doesn't use Enabled or Start/Stop - uses Change instead.
0
 
srcalcAuthor Commented:
Thanks for the clarification
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.