0

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 pictureBoxes 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).

Mikle
  • 1
  • 1
    You haven't tagged the language you work in, and I can't really see a question – you should [edit] it to say what specifically you're expecting to happen, and what happens instead. – Benjamin W. Apr 25 '17 at 14:41
  • "Any ideas are greatly appreciated" --- how about this: ask a question. – zerkms Apr 27 '17 at 04:14

1 Answers1

0

From what I can get from your question, I think your dog should have a method like showOnPictureBox(PictureBox p) and maybe a property that holds the PictureBox that the dog is currently "in".

Rob
  • 11,492
  • 14
  • 59
  • 94