Method to register method to be called when event is raised
- by zaidwaqi
I have a Panel which contains 20 PictureBox controls. If a user clicks on any of the controls, I want a method within the Panel to be called.
How do I do this?
public class MyPanel : Panel
{
public MyPanel()
{
for(int i = 0; i < 20; i++)
{
Controls.Add(new PictureBox());
}
}
// DOESN'T WORK.
//…