Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Indirect reference to controls or binding to arraylist i
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01341965
Message ID:
01343190
Vues:
23
Hi Paul,

That will make life much simpler. Thanks for the tip.

>>
>>UPDATE: I did get this to work. I limited the number of controls I have to search through by putting them in an mmgroupbox and used an arraylist to make it easier to work backwords from the control name to the correct text value.
>>
>
>You don't actually have to run through all of the controls. The Control collection has a Find() method, ex:
>
>
>string name = "textBox1";
>Control[] control = this.Controls.Find(name);
>if (control.Length > 0 && control is TextBox)
>{
>   TextBox txt = (TextBox)control[0];
>   txt.Text = "My Control";
>}
>
>
>Or, even simpler:
>
>
>string name = "textBox1";
>Control control = this.Controls[name];
>TextBox textBox = control as TextBox;
>if (textBox != null)
>{
>   textBox.Text = "My Control";
>}
>
Linda Harmes
HiBit Technologies, Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform