c# - Refresh an open form from another open form -


i want refresh opened form (form1) opened form's (form2) button_click(). in form1 display data saved form2 , when form1 opened want refresh if new data saved on form2 in order display it.

the problem i've tried iterating through `application.openforms`, turns out read-only , cannot access form once found , don't know how access *form1* *form2*, since can't find it.

how can access *form1* *form2*?

edit:

form1 opened form2.

the problem application.openforms , i've stated, read-only list of forms opened , cant access forms through it. don't have methods it, sugest try using application.openforms , if don't know how works. it's pointless show i've tried because includes application.openforms, sake of information:

formcollection of = application.openforms;                 foreach (var f in of)                 {                     if (f.gettype().tostring() == "kontrl_doc.visualizar")                     {                         f.refresh();                     }                 } 

when click button (button_click()) in form2 checks if form1 open or not. if form1 isn't open opens 1 , if i'd refresh it. simultaneously, closes form2 , opens form2 again, in order reset fields.

wan is, if form1 opened , form2 should tell refresh opened window form 1.

"form1 opened form2" - if case, call refresh using form variable have in form2. if necessary, make private field in form2 class or store in array later use.

for example:

(somewhere in form2)

form1 form1 = new form1(); form1.show(); 

(inside button click in form2)

form1.refresh(); 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -