MPIon
Well-known member
I have a form with several picture boxes named pictureBox1, pictureBox2, pictureBox3
I can set an individual image in one of the boxes using code :
However, I want to be able to set the image for a specified picture Box using an index value.
(this is easy to do in Visual Basic - just put for example Me("pictureBox" & 3).Picture to set the picture in pictureBox3)
I am sure there must be a simple way to do this in c# and have looked at numerous examples, but can't get any to work - they won't even compile.
e.g.
Can anyone help with this?
I can set an individual image in one of the boxes using code :
C#:
pictureBox1.Image = Image.FromFile(<full path name for image file>);
(this is easy to do in Visual Basic - just put for example Me("pictureBox" & 3).Picture to set the picture in pictureBox3)
I am sure there must be a simple way to do this in c# and have looked at numerous examples, but can't get any to work - they won't even compile.
e.g.
C#:
Controls["pictureBox" + 3.ToString()].Image = Image.FromFile(<full path name for image file>);
Can anyone help with this?