Hi,
I want to write a code (by reflection ) to get the all button controls on a
mdi form. my sample code for that :
---------------------------------
FieldInfo[] fieldInfo = this.GetType(). GetFields(Bindi ngFlags.NonPubl ic |
BindingFlags.In stance | BindingFlags.Pu blic);
for (int i = 0; i < fieldInfo.Lengt h; i++)
{
object obj = fieldInfo[i].GetValue(this) ;
string fieldName = fieldInfo[i].Name;
if (obj is System.Windows. Forms.Button)
{
// to do somthing
}
}
---------------------------------
It works for design-time controls.But, if i create button controls
dynamically in tun-time , i can not get these tun-time controls.
Do you have any idea to get controls that is added in run-time .. ?
Thanks.
Adam Right
I want to write a code (by reflection ) to get the all button controls on a
mdi form. my sample code for that :
---------------------------------
FieldInfo[] fieldInfo = this.GetType(). GetFields(Bindi ngFlags.NonPubl ic |
BindingFlags.In stance | BindingFlags.Pu blic);
for (int i = 0; i < fieldInfo.Lengt h; i++)
{
object obj = fieldInfo[i].GetValue(this) ;
string fieldName = fieldInfo[i].Name;
if (obj is System.Windows. Forms.Button)
{
// to do somthing
}
}
---------------------------------
It works for design-time controls.But, if i create button controls
dynamically in tun-time , i can not get these tun-time controls.
Do you have any idea to get controls that is added in run-time .. ?
Thanks.
Adam Right
Comment