这是我的代码:
string strFileName = "calCommonTest.dll";//程序集名称
string strPath = Application.StartupPath;//程序集路径
Assembly ass = Assembly.LoadFile(strFilePath);
string[] s = ass.GetManifestResourceNames(); //ClassMultiForm.Form2.resources
Object ojForm = ass.CreateInstance("calCommonTest.frmCommonTest"); //生成窗体对象
Form f = (Form)ojForm;
为什么到“生成窗体对象”那一步时,得到的ojForm 总是为空值,小弟实在不懂了,请教大虾们!!!
string strFileName = "calCommonTest.dll";//程序集名称
string strPath = Application.StartupPath;//程序集路径
Assembly ass = Assembly.LoadFile(strFilePath);
string[] s = ass.GetManifestResourceNames(); //ClassMultiForm.Form2.resources
Object ojForm = ass.CreateInstance("calCommonTest.frmCommonTest"); //生成窗体对象
Form f = (Form)ojForm;
为什么到“生成窗体对象”那一步时,得到的ojForm 总是为空值,小弟实在不懂了,请教大虾们!!!
string name=strName; //类的名字
Form fm=(Form)Assembly.Load(path).CreateInstance(name);
版本和DLL路径
Object ojForm = ass.CreateInstance("calCommonTest.frmCommonTest"); //生成窗体对象
这一句里面的“calCommonTest”是命名空间,“frmCommonTest”是窗体类的名称,这样有错么?