Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Timer Enabled, Start, Stop

Posted on 2004-08-13
6
Medium Priority
?
369 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:srcalc
  • 3
  • 2
6 Comments
 
LVL 19

Assisted Solution

by:drichards
drichards earned 160 total points
ID: 11794338
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
 
LVL 4

Author Comment

by:srcalc
ID: 11794359
They are 100% exactly the same?
0
 
LVL 3

Accepted Solution

by:
DJ_Back-Q earned 240 total points
ID: 11794389
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 4

Author Comment

by:srcalc
ID: 11794408
Ok thanks!
0
 
LVL 19

Expert Comment

by:drichards
ID: 11794510
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
 
LVL 4

Author Comment

by:srcalc
ID: 11794542
Thanks for the clarification
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Integration Management Part 2
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question