G
Guest
I'd like to create a form by reflection. My forms' constructor takes 3 arguments so I have to use the 'long' CreateInstance overload as described below.
Assembly assembly = Assembly.Load("<myassembly>");
object oForm = assembly.CreateInstance("<myform>", true, BindingFlags.Default, null, <myctorargs>, null, null);
When running above code I get a TargetInvocationException. I DO have my assembly- and type-name correct. Is it the BindingFlags argument that causes problems? Could anybody provide me with an example of CreateInstance-arguments that would work?
Assembly assembly = Assembly.Load("<myassembly>");
object oForm = assembly.CreateInstance("<myform>", true, BindingFlags.Default, null, <myctorargs>, null, null);
When running above code I get a TargetInvocationException. I DO have my assembly- and type-name correct. Is it the BindingFlags argument that causes problems? Could anybody provide me with an example of CreateInstance-arguments that would work?