Solved

Timer Enabled, Start, Stop

Posted on 2004-08-13
6
361 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 40 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 60 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Definitions and default visual studio colors 5 65
VS.net 2010 11 35
VB.net Open Folder in Windows Explorer 3 29
get combo value in class 5 8
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 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