Enumerate the child controls in the form and if a control is a picture box, take the desired action.
foreach (Control ctrl in this.Controls)
{
if (ctrl is PictureBox)
{
}
}
If your
PictureBox controls are inside containers, you'll have to write a recursive method that will accept the parent container, like so:
private void ChangePictureBoxes(Control container)
{
foreach (Control ctrl in this.Controls)
{
if (ctrl.HasChildren)
{
ChangePictureBoxes(ctrl);
}
else if (ctrl is PictureBox)
{
}
}
}
This is really the only way you can do what you want without worrying about control names...