Assigning the Tick event handler to a Timer

suggest change

For System.Windows.Forms.Timer, the work runs in the Tick event handler. System.Timers.Timer uses Elapsed instead of Tick.

public partial class Form1 : Form
{

    Timer myTimer = new Timer();

    
    public Form1()
    {
        InitializeComponent();

        myTimer.Tick += myTimer_Tick; //assign the event handler named "myTimer_Tick"
    }

    private void myTimer_Tick(object sender, EventArgs e)
    {
        // Perform your actions here.
    }
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents