日期:2014-05-19  浏览次数:20695 次

如何根据窗体的字符串生成窗体实例?
如字符串为string   s= "UiApp.BasicInfo.frmclient ".
如何通过s来生成窗体UiApp.BasicInfo.frmclient的实例?以达到和UiApp.BasicInfo.frmclient   fc=new   UiApp.BasicInfo.frmclient()同样的效果。

------解决方案--------------------
string fName = "UiApp.BasicInfo.frmclient ";
Form myForm;

myForm = (Form)System.Activator.CreateInstance
(Type.GetType(fName));
------解决方案--------------------
可以的。