c# - How to call method from all opened forms -
I want to call a method in all open forms
this call call MyUpdateFnc () last Csutomer Open Form:
if (application.OpenForms ["frmCustomer"] = faucet) {(application.from ["frmCustomer"] as frmCustomer). MyUpdateFnc (); } Many forms may be open.
You can get the Application.OpenForms.OfType & lt; T & gt; By using the method, all the types of type you want. After this you have to run again through the form collection. For example, use the foreach loop as follows: foreach (application in frmCustomer frm. OpenForms.OfType & lt; frmCustomer & gt; ()) Frm.MyUpdateFnc ();
Comments
Post a Comment