hi there,

there are 9 labels on the form with the name say Label1, Label2, Label3, ...
now i would like to set their text to "". is there anyway to use a loop and find them just by knowing their name.

any help is appreciated,

A form has a ControlsCollection which is called Controls.
You can loop through that with a foreach. Something like this:

// look through the controls of the form
            foreach (Control c in this.Controls)
                if (c is Label) //see if it is a Label control
                    // now do something with it

thanks ddanbe. :icon_smile: