Find multiple controls with by partially matching their name

Viewed 4443

I currently have 100+ labels, with names like:

labelNumber1 
labelNumber2 
labelNumber3 
labelNumber4 
....
labelLetter1
labelLetter2 
labelLetter3 
labelLetter4
....

How would I find all the labels that have "Number" in the controls name? Instead of having to type out labelNumber1.text = "hello", etc.

I have tried regex and foreach with wild cards but did not succeed. I have looked on msdn.microsoft.com about using regex with a control.

3 Answers
Related