G
Guest
I am writing a click event for an array of PictureBoxes:
for (int i = 0; i < 10; i++)
pic.Click += new EventHandler (pic_Click);
private void pic_Click (object sender, System.EventArgs e)
In the event handler, I want to type cast the "sender" to a PictureBox, so I
can do ((PictureBox) sender).Location to change its location rather than
using a loop to compare the sender with each PictureBox in the array.
How to do this in C#?
Thank you in advance.
Eric
for (int i = 0; i < 10; i++)
pic.Click += new EventHandler (pic_Click);
private void pic_Click (object sender, System.EventArgs e)
In the event handler, I want to type cast the "sender" to a PictureBox, so I
can do ((PictureBox) sender).Location to change its location rather than
using a loop to compare the sender with each PictureBox in the array.
How to do this in C#?
Thank you in advance.
Eric