I have a simple for loop as follows:
for (int i = 0; i > 20; i++)
{
}
Now I have 20 labels (label1, label2, label3 and so on..)
I would like to do something like:
for (int i = 0; i > 20; i++)
{
label[i].Text = String.Empty;
}
What is the easiest way to accomplish this?
If your labels are placed on one container, say
Form, you may do the following:Same for any other container, say,
PanelorGroupBox, just replacethiswith the name of the container (panel1.Controls, etc.)