DataTable dt = new DBHelper().getIndexInfo(code_id); DataRow row = dt.Rows[0]; string dllName = row["DLL_NAME"].ToString(); string frmName = row["FORM_NAME"].ToString(); //程序集 System.Reflection.Assembly asmb = System.Reflection.Assembly.LoadFrom(dllName); //得到类 Type ftype = asmb.GetType(frmName); Form form; if (frmName.ToUpper().Equals("TRAINING.INPUTMODELFORM")) { /** * 创建一个实例 * ftype 要创建的类型 * code_id, code_name, proc 目标类的构造方法中的参数 * 后面的参数个数不限定,根据构造方法确定 * */ form = (Form)Activator.CreateInstance(ftype, code_id, code_name, proc); } else if (frmName.ToUpper().Equals("EXCEPTIONACCOUNTINGWORK.FRMEXCEP")) { form = (Form)Activator.CreateInstance(ftype, code_id); } else { form = (Form)Activator.CreateInstance(ftype); } form.MdiParent = this.ParentForm; form.WindowState = FormWindowState.Normal; form.Show();
【注】2012-03-16百度空间迁移