I have a Class Dogs
, and one of its properties is called MyPictureBox
(type of PictureBox
). I also have four picture boxes on the windows form.
I have this piece of code assigning corresponding pictureBox
es to the instance of each Dog
. And this works just fine.
Dogs[0].MyPictureBox = pictureBoxDog1;
Dogs[1].MyPictureBox = pictureBoxDog2;
Dogs[2].MyPictureBox = pictureBoxDog3;
Dogs[3].MyPictureBox = pictureBoxDog4;
I spent some time trying to cycle through Dogs and assign pictureBox
using its name (as the only difference in picture box name is the ending 1,2,3,4) with no luck.
Any ideas are greatly appreciated (hate to move ahead without solving this first).