using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace WinFormsApp
{
public partial class MainForm : Form
{
private readonly Timer _timer;
private int _counter;
public MainForm()
{
InitializeComponent();
_timer = new Timer();
_timer.Interval = 500;
_timer.Tick += OnTimerTick;
}
private void OnFormLoad(object sender, EventArgs e)
{
_timer.Start();
}
private void OnTimerTick(object sender, EventArgs e)
{
_label.Text = $"{nameof(OnTimerTick)}. {(++_counter).ToString()}";
}
}
}