Click here to Skip to main content
15,914,074 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
//formname contains the value ("EditFrom")
//but the following returnFromName shows null

returnFromName=(FormClas)Assembly.GetEntryAssembly().CreateInstance(formname);
Posted
Updated 1-Sep-11 7:14am
v2

You need to pass the full name.
http://msdn.microsoft.com/en-us/library/dex1ss7c.aspx[^]

The full name would be My.Namespaces.MyForm
 
Share this answer
 
It seems to me that you have the type of the Form at designtime. You could use other methods to create your Form using reflection, like Activator.GetInstance(Of frmMyForm)[^].
Also note that the best way to instantiate a Form is by simply calling the constructor.
Like so:
C#
frmMyForm frm = New frmMyForm();
frm.Show();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900