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

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -