1
Answer

How to get controls of the form from an assembly using Reflection?

Ask a question
blazej blazej

blazej blazej

13y
3.6k
1
I am trying to retrieve all control names of the form from compiled assembly. 
 
I can get the list of all forms:
Assembly asm = Assembly.LoadFrom(_assemblyPath); // Get the list of types defined in the assembly and derived from System.Windows.Forms.Form var lForms = asm.GetTypes().Where(x => x.IsSubclassOf(typeof(Form))).ToList();

But then I have a problem when I am trying to instantiate the types (as I need to retrieve the controls of the form).
I cannot use the:

Form o = Activator.CreateInstance(form, true) as Form;

as some forms have no default constructors defined.

Is there any other way to retrieve the data I need?

Regards


Answers (1)