//方法1使用activator方法建立執行個體{string str = null;str = "Form2";//必須是 命名空間+點+表單類名(這裡假設為命名空間為空白)Assembly tempAssembly = Assembly.GetExecutingAssembly();Type t = tempAssembly.GetType(str);object[] args = null;object o = System.Activator.CreateInstance(t, args);((Form2)o).Show();//Dim frm2 As Form = CType(tempAssembly.CreateInstance(str), Form)//frm2.Show()//////////////////方法2使用建構函式的invoke方法建立執行個體。Type[] ty = { };//該建構函式沒有參數ConstructorInfo c = t.GetConstructor(ty);//獲得沒有參數的建構函式object[] args1 = null;//參數為空白object p = c.Invoke(null);//建立執行個體時參數為空白((Form2)p).Show();//方法3 ‘///////////////////////////////////////使用assembly.createinstance方法建立執行個體string str = null;str = "Form2";//必須是 命名空間+點+表單類名System.Reflection.Assembly tempAssembly = System.Reflection.Assembly.GetExecutingAssembly();Form frm2 = (Form)tempAssembly.CreateInstance(str);frm2.Show();}