C# timer v VB6 timer

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

With the VB6 timer, it was simply a matter of setting Enabled = true to
start the timer, and Enabled = false to stop the timer. With C# you
also have Start and Stop methods. To get the same functionality as VB6,
would it simply be a case of making all timers enabled all the time, and
starting and stopping them using Start and Stop, or do you need to
Enable, then Start, then Stop, then Disable, then Enable again etc.
What is the difference between these 2 ways of using the timer?


Any help would be really appreciated.


Cheers,

Mike
 
Mike,

You can use the Enabled property or the Start/Stop methods. The
Start/Stop methods just set the Enabled property to true/false.

Hope this helps.
 
Nicholas,

I was thinking that maybe Stop only stops the timer, but setting Enabled
= false resets the timer as well? Why would there be any need for Start
and Stop otherwise?


Mike
 
Mike,

From what I can tell, setting the Enabled/Disabled properties doesn't
reset the timer. Can you show an example where it does?
 
If you have a timer that has an interval of 10 minutes, if you stop it
after 7 minutes, then start it again it will only have 3 minutes left
before it calls the Tick event. However, if you reset it, it is still
10 minutes before the Tick event is called. I wondered whether this was
how the Timer behaves.
 
How about writing a simple code to check it out ;)

As for the System.Windows.Forms timer, the Start() and Stop() methods simply
do Enabled = true and Enabled = false respectively. The countdown is always
restarted after reenabling.

HTH,
Stefan
 
Back
Top