I have the following code-
private void button1_Click(object sender, EventArgs e)
{
_soundplayer.Play();
timer1_Tick();
}
private void timer1_Tick()
{
pictureBox1.Image = imageList1.Images[imgIndex++];
}
For some reason this brings back the error in the Form1.Designer.cs –
Error 1 No overload for 'timer1_Tick' matches delegate 'System.EventHandler'
When button1 is clicked the image in pictureBox1 should change every 2 seconds with the timer tick, however I can’t get past this error. Please advise.
The Tick event is an event of type EventHandler. It requires two arguments for the event handler:
Which requires you to modify the Click event handler like this:
Using the designer to add event handlers can keep you out of trouble like this. Select the timer, click the lightning bolt icon in the Properties window and double-click Tick.