8
Answers

How to loop through controls(different).

Ask a question
Liam Stevens

Liam Stevens

13y
1.9k
1
Hi, I need to loop through a bunch of picture boxes that I have, all with names such as:

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)

  1. for (int i = 0; i < 3; i++)
  2. {
  3. PictureBox(i).enabled = false;
  4. }



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

Answers (8)