Hello gusse,
>how do I get a list of all components on a form using reflection ??
Assuming you are in the constructor (and I understand all kinds of missing
details about your question correctly <g>):
Type formType = this.GetType( );
FieldInfo[] fields = formType.GetFields(BindingFlags.Instance |
BindingFlags.NonPublic);
foreach (FieldInfo field in fields) {
if (typeof(Component).IsAssignableFrom(field.FieldTyp e))
Debug.WriteLine(field.Name);
}
>or is there another way of doing this ??
Is there another way of doing what?
Oliver Sturm
--
http://www.sturmnet.org/blog