PictureBox00, PictureBox01, PictureBox02 etc.
I need to loop through these and adjust their values by what the current value in the loop is, I basically want to do this to it:
C# Syntax (Toggle Plain Text)
- for (int i = 0; i < 3; i++)
- {
- PictureBox(i).enabled = false;
- }
I need to access them like an array, I will not know what picturebox I would be dealing with at that time, only way I can see to do this is by using the loop, cheers.
EDIT: I think this was pretty easy to do in VB.NET via DirectCast, not sure if that would be used here(the similar version).

VulpesRank #55 · 29.2K reputationPosted Aug 24, 2011, 4:47 AM EDT
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Aug 24, 2011, 4:15 AM EDT
Put all picture in GrouopBox or canvas or something like that and access that like
PictureBox pic = canvas.children[0] as PictureBox;
PictureBox pic = groupBox1.Controls[0] as PictureBox;
Liam Stevens7 reputationPosted Aug 24, 2011, 4:21 AM EDT
Don't think I can put them in a groupbox, ty for reply however.
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Aug 24, 2011, 4:24 AM EDT
Liam Stevens7 reputationPosted Aug 24, 2011, 5:23 AM EDT
I changed it slightly from:
PictureBox pic = (PictureBox)this.Controls["PictureBox0" + i.ToString];
To this:
PictureBox pic = (PictureBox)this.Controls["PictureBox" + i.ToString("00")];
This way it will count up correctly and will be fine when past 10, cheers will try it out now.
VulpesRank #55 · 29.2K reputationPosted Aug 24, 2011, 5:38 AM EDT
Liam Stevens7 reputationPosted Aug 24, 2011, 6:33 AM EDT
This:
["tile_" + j.ToString("00")]
Any way I can subtract 1 from j at the same time, such as:
["tile_" + j - 1.ToString("00")]
Cheers.
VulpesRank #55 · 29.2K reputationPosted Aug 25, 2011, 1:09 AM EDT