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).
VulpesPosted Aug 24, 2011, 8:47 AM
VulpesPosted Aug 25, 2011, 5:09 AM
Liam StevensPosted Aug 24, 2011, 10:33 AM
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.
VulpesPosted Aug 24, 2011, 9:38 AM
Liam StevensPosted Aug 24, 2011, 9:23 AM
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.
Jaganathan BantheswaranPosted Aug 24, 2011, 8:24 AM
Liam StevensPosted Aug 24, 2011, 8:21 AM
Don't think I can put them in a groupbox, ty for reply however.
Jaganathan BantheswaranPosted Aug 24, 2011, 8:15 AM
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;