Last post Nov 22, 2016 07:17 AM by allenscott
Nov 14, 2016 01:03 PM|markdevid|LINK
I am beginner in c# programming language.I want to use timer in my project.Please help me to creating a timer .I would really appreciate your help.
Nov 14, 2016 01:21 PM|bbcompent1|LINK
Hello, timers can be used for a variety of purposes however I may be able to help you better if I understand what you are trying to do. There are three timer-based classes which are threading, timer, and task. A basic example of timers is as follows:
static void Main()
Timer timer = new Timer(1000); // In milliseconds 1000 ms = 1 second
timer.Elapsed += async ( sender, e ) => await HandleTimer();
Console.Write("Press any key to exit... ");
private static Task HandleTimer()
Console.WriteLine("\nHandler not implemented..." );
throw new NotImplementedException();
Mind you, this is the most basic example of a timer in C# code and while it is a console application code, the concept is still the same. So exactly what are you trying to do?
Nov 22, 2016 07:17 AM|allenscott|LINK
In the following program we display the current time in a Label Control. In order to develop this program, we need a Timer Control and a Label Control. Here we set the timer interval as 1000 milliseconds, that means one second, for displaying current system
time in Label control for the interval of one second.
public partial class Form1 : Form
private void timer1_Tick(object sender, EventArgs e)
label1.Text = DateTime.Now.ToString();
Check also this helpful link abou8t timer in c#.
Timer in c#
C# timew tutorial