Find multiple controls with by partially matching their name
问题 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. 回答1: You can loop through the Controls collection of the form