Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding a Control by Name
Message
De
05/09/2007 23:00:19
 
 
À
05/09/2007 13:37:09
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01252529
Message ID:
01252654
Vues:
26
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform