Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 c# .net 中有一个子表单。从中我正在访问 MDI 表单,例如:
Type t = Type.GetType("namespace" + "MdiFormName"); Form c = Activator.CreateInstance(t) as Form;
我的 MDI 表单有一种名为:
public datatable CalluserRights()
现在我想CalluserRights() 从我的子窗体中调用 MDI 窗体的方法。
CalluserRights()
谁能帮我?
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);