I have an array of pictureboxes and they all have the same onclick method. The method is supposed to edit the picturebox.
My code looks like this
box.Click += new System.EventHandler(boxClick);
private void boxClick(object sender, EventArgs e)
{
sender.Image = brush.CurrentImage;
}
Not very complex, but for some reason the IDE is telling me that object is not containing a definition for Image.
But sender definitely has a Image property (I can even see it when debugging…)
Can someone please tell me what I’m doing wrong? I’m sure it’s possible to change a control’s property on click…
Thanks
Description
Right,
objecthas no property.ImageSample
You have to cast the
sendertoPictureBoxlike this