C# 反射動態調用窗體的問題
private void CreateForm(string strName) {
this.Cursor = Cursors.WaitCursor;
string path = "feiwu";//项目的Assembly选项名称
string name = strName; //类的名子
Form fm = (Form)System.Reflection.Assembly.Load(path).CreateInstance(name);
//fm.MdiParent = this.ParentForm;
fm.Show();-此處报错:并未将物件参考设定为物件的执行个体
//fm.Dock=DockStyle.Fill;
//this.Cursor = Cursors.Default;
}
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
string fn = "Form2";
CreateForm(fn);
}
请大侠们帮忙指出错误的地方應如何修正,或是给出更好的方法!谢谢!