Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
string formname=Assembly.GetEntryAssembly().GetName().Name+"."+"AddForm";
//actually formname contain this string "DynamicProject.AddForm"
Type tp=Type.GetType(formname);
//but tp shows null value
Posted

Put a try/catch block around it and run the code under the debugger, and you'll find out exactly what's wrong.
 
Share this answer
 
Is that AddForm really exist in your application, Check this code and find what the error is
Type tp=Type.GetType(formname, true);


This are the syntaxes used to get type

Type GetType(string typeName);

   Type GetType(string typeName, bool throwOnError);

   Type GetType(string typeName, bool throwOnError, bool ignoreCase);
 
Share this answer
 
v2

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

  Print Answers RSS


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