> Well I thought that there is an option to go directly to the control by
its
name,
This loop will increase the processing & presenting time since there are
lots of other controls on this form
If you have many controls on the form, you can use for example Hashtable and
add all your Controls to it with their name as a key. Accessing items in a
hashtable is a constant time operation, so there is virtually no performance
hit if you use the hashtable.
On form.Load or elsewhere
this.controlHashtable = new HashTable();
foreach Control c in this.Controls
{
this.controlHashtable.Add(c.Name, c);
}
private Control GetControlByName(string name)
{
return this.controlHashtable[name] as Control;
}