C# Timer
Written by: maffelu , 2009-05-30 13:32:48
private void timTimer_Tick(object sender, EventArgs e)
{
txtMain.AppendText(string.Format("Time: {0}\n", DateTime.Now.ToLongTimeString()));
}
private void btnStart_Click(object sender, EventArgs e)
{
timTimer.Enabled = true;
}
private void btnStop_Click(object sender, EventArgs e)
{
timTimer.Enabled = false;
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timTimer_Tick(object sender, EventArgs e)
{
txtMain.AppendText(string.Format("Time: {0}\n", DateTime.Now.ToLongTimeString()));
}
private void btnStart_Click(object sender, EventArgs e)
{
timTimer.Enabled = true;
}
private void btnStop_Click(object sender, EventArgs e)
{
timTimer.Enabled = false;
}
}
There are 12 comments on this article.
AG
2010-08-19 03:00:23
Good Example
Harshal
2011-07-04 23:27:15
It is easy to understand.
GAURAV
2011-07-18 23:25:46
thanks for help, it is simple & good example....
Sathish Babu G
2011-07-21 01:13:12
Short and Sweet !
Usha
2011-07-22 07:29:04
Thanks... it is really simple. The way u explained is simply superb....
Ravi Chandran
2011-08-19 07:33:45
Hi,
This Coding is simply superb and easy to
understand the concept of Timer.
Thanks
ziya
2011-08-21 12:59:19
can u give full use of marquee and timer in c#
Mohamed
2011-09-19 00:50:08
Of the finest examples and the simplest
Thanks you
Kapil
2011-09-25 08:58:31
Excellent
pavan
2011-10-04 18:23:36
nice
rakesh rajput
2011-12-07 05:32:42
nice
If you have any question or just want to leave a message, just fill out the form below!
Your e-mail will not be visible in your post, it is for validation reasons only
Maffelu
Creator and admin of MorkaLork.com.
Started programming in HTML back when frames and tables was the way to design a page, moved on to Pascal/Delphi, PHP, javascript/jQuery, VB.NET/C#, Java and C++.
Currently studies .NET (in general) focusing on ASP.NET.
sani
2010-04-28 01:54:38
wonderful article. thanks