26 Temmuz 2012 Perşembe

access to main form from child fom (WinForms)

Assume ChildForm is opened from MainForm:

ChildForm form= new  ChildForm  ();

Now, to access MainForm from ChildForm (to refresh something on MainForm etc.), call this from child form:

MainForm parent = ( MainForm  )this.Owner;
// do sonething in parent form
this.Close(); // close child form


Hiç yorum yok:

Yorum Gönder