-1

我在 c# .net 中有一个子表单。从中我正在访问 MDI 表单,例如:

 Type t = Type.GetType("namespace" + "MdiFormName"); 
 Form c = Activator.CreateInstance(t) as Form; 

我的 MDI 表单有一种名为:

 public datatable CalluserRights()

现在我想CalluserRights() 从我的子窗体中调用 MDI 窗体的方法。

谁能帮我?

4

1 回答 1

0
Type t = Type.GetType("namespace" + "MdiFormName"); 

MethodInfo method = t.GetMethod("CalluserRights");

Form c = Activator.CreateInstance(t) as Form;

//will call CalluserRights method and return datatable 
object datatable = method.Invoke(c, null);
于 2013-05-30T12:21:52.060 回答