Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
what is the difference between start and enable in timers?
what is a tick event?
how can we set a value to timers?(run the timer for a specific time)
Posted

1 solution

There are three different timer classes in C#:


All the MSDN help pages referenced above document usage of those timers quite clearly.

I would strongly advice:

  1. Avoid using System.Windows.Forms.Timer; it simplest to use but is the most inaccurate. The other two types require to use the method Invoke or BeginInvoke of System.Windows.Threading.Dispatcher (for both Forms or WPF) or System.Windows.Forms.Control (Forms only).
    See:
    http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx[^],
    http://msdn.microsoft.com/en-us/library/system.windows.forms.control.aspx[^].
  2. Avoid using timers by all means; use threads whenever possible.
  3. Avoid questions in the form "What's the difference between {0} and {1}"; they cannot be correct.


—SA
 
Share this answer
 
v5
Comments
Pravin Patil, Mumbai 4-Oct-11 1:22am    
+5 for the answer...
had it been possible to vote second time, I would have voted for the way you presented answer.... Very neat and clean and clear... +5 to that as well...
Sergey Alexandrovich Kryukov 4-Oct-11 1:24am    
Thank you very much, Pravin.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900