---
title: "Timer in C Sharp"  
description: "The Timer control allows you to set a time interval to peridically execute an event at a specified interval. It is useful when you want to execute cer"  
author: "Anonymous User"  
published: 2010-07-31  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/97/timer-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Timer in C Sharp

The Timer control allows you to set a time interval to peridicallyexecute an event at a specified interval. It is useful when you want to execute certain applications after a certain interval. Say you want to create a hourly backup of your data. You can make a routine that will take the backup and call that routine in the Timer's event and set the timer interval for an hour.

Using timer control is very simple. To demonstrate this I am going to make an application in which 5 seconds after button click a message box will be displayed “Timer working”.

##### To use timer control drag and drop timer control from tool box to the form.

![Timer in C Sharp](https://www.mindstick.com/mindstickarticle/e32b0606-f6fe-456a-a2ed-f6b74a8750ac/images/87db0671-8a49-4ef6-8cbc-0b5fb567c58c.png)

##### Coding

Code at button click event.

```
private void btnClick_Click(object sender, EventArgs e)        {//setting interval of timer to 5000 miliseconds.//1000 miliseconds = 1 sec//so 5000miliseconds = 5 sec.            timer1.Interval = 5000;//starting timer.            timer1.Enabled = true;        } //code for timer tick event        private void timer1_Tick(object sender, EventArgs e)        {//displaying message box.            MessageBox.Show("Timer Working");//stoping timer.            timer1.Enabled = false;                    }
```

##### Screen shot

![Timer in C Sharp](https://www.mindstick.com/mindstickarticle/e32b0606-f6fe-456a-a2ed-f6b74a8750ac/images/f430b6e9-9ef5-4257-9b74-f4e85f3d67ef.png)

##### Member of timer

\

| Tick\ | This event occurs when the Interval has elapsed. \ |
| --- | --- |
| Start\ | Starts raising the Tick event by setting Enabled to true. \ |
| Stop\ | Stops raising the Tick event by setting Enabled to false. \ |
| Close\ | Releases the resources used by the Timer. \ |
| AutoReset\ | Indicates whether the Timer raises the Tick event each time the specified Interval has elapsed or whether the Tick event is raised only once after the first interval has elapsed.\ |
| Interval\ | Indicates the interval on which to raise the Tick event.\ |
| Enabled\ | Indicates whether the Timer raises the Tick event.\ |

---

Original Source: https://www.mindstick.com/articles/97/timer-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
