AssemblyName an = new AssemblyName("WinForm");
Form fm = (Form)Assembly.Load(an).CreateInstance("WinForm.ProductForm");
fm.Show();
以上是可以调用成功的,但现在有个需要,就是窗体的调用需要带参数:
如:一般这样实例的:
ProductForm pd = new ProductForm("ClassId");
当有了一个ClassId之后,上面的程序应该怎样写?
我这样写是错的:
AssemblyName an = new AssemblyName("WinForm");
Form fm = (Form)Assembly.Load(an).CreateInstance("WinForm.ProductForm('ClassId')");
fm.Show();
请各高手帮帮忙....
...全文
1396打赏收藏
怎样动态调用带参数的窗体???急急急..以线等
AssemblyName an = new AssemblyName("WinForm"); Form fm = (Form)Assembly.Load(an).CreateInstance("WinForm.ProductForm"); fm.Show(); 以上是可以调用成功的,但现在有个需要,就是窗体的调用需要带参数: 如:一般这样实例的: ProductForm pd = new ProductForm("ClassId"); 当有了一个ClassId之后,上面的程序应该怎样写? 我这样
AssemblyName an = new AssemblyName("WinForm");
Form fm = (Form)Assembly.Load(an).CreateInstance("WinForm.ProductForm", false,
BindingFlags.CreateInstance, null, new object[] { "Zswang 路过" },
null, null);