|
I am trying to load a form dynamically at runtime. I want to get a handle to the Form just from the form's name. So far it seems like CreateInstanceWithUnwrap should do what I want. Unfortunately I'm not sure how to get the AssemblyName of the Application itself. Its a simple Windows Form app. Here is the code I'm using:
AppDomain currentDomain = AppDomain.CurrentDomain; object instance = currentDomain.CreateInstanceAndUnwrap( "", "Form2" );
I was assuming that if you didn't pass in the first parameter that the current Assembly would be assumed. Unfortunately I get the error: String cannot have zero length.
Is there an easier way to do this? Or how do I get the Assembly Name for the application itself. I looked in AssemblyInfo.cs but didn't see anything promising there...
Any ideas?
Thanks, David House |