Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding a Control by Name
Message
From
05/09/2007 23:00:19
 
 
To
05/09/2007 13:37:09
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
01252529
Message ID:
01252654
Views:
27
Hi Bill,

The Controls collection has a Find method that looks like it might do the trick, but I haven't actually tried it. I think it would probably be used like this:
this.Controls.Find("MyControl", true);
The second parameter is for SearchAllChildren.

~~Bonnie


>If a control is nested within other controls on a Windows form and the control Name is known, is it possible to get a reference to the control without doing a recursive search of the control array? Recursively searching the control array is the only method I have been able to find for this. Although this works, I would prefer a more direct approach if one exists.
>
>Thanks,
>Bill
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform