A
Adam Right
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(BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.Public);
for (int i = 0; i < fieldInfo.Length; i++)
{
object obj = fieldInfo.GetValue(this);
string fieldName = fieldInfo.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(BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.Public);
for (int i = 0; i < fieldInfo.Length; i++)
{
object obj = fieldInfo.GetValue(this);
string fieldName = fieldInfo.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