1. File> New Project
2. Drag and Drop over Form1:
– label1
– timer1
You will not see the timer component inside the form because it has not a visual rapresentation, it will be added under the component bar, below the graphic form.
3. Click over timer1 and on the right on the ‘Properties’ windows set:
Enabled: True
Interval: 1000 (millisecons), so it refresh every 1 second
4. Double Click timer1 to add the handle inside Form1.cs:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace TimerTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void timer1_Tick(object sender, EventArgs e) { label1.Text = DateTime.Now.Second.ToString(); // it renders: 15 16 17 18 etc... } } }