Example:
Example below shows how to restore MDI Child form to its default state without opening a new Child Form if that MDI Child form is already open.
Child Form Click Event:
private void formTest_Click(object sender, EventArgs e) { if (CheckMdiClientDuplicates("Namespace01.FormTest", "FormTest") == true) { FormTest childForm = new FormTest(); childForm.MdiParent = this; childForm.Show(); } }
CheckMdiClientDuplicates Function:
internal bool CheckMdiClientDuplicates(string WndCls,string fName) { Form[] mdichld = this.MdiChildren; foreach (Form selfm in mdichld) { string str = selfm.Name; if (str == fName) { selfm.WindowState = FormWindowState.Normal; return false; } } return true; }---------------------------------------------------------
Note: ** Namespace01 is the namespace of MDI Parent Form.
** For more information please Contact Us.
1 comments:
V r grateful 2 Calcutta Institute Of Engineering & Management,Indian Institutes of Technology, B.p.poddar Institute of Management and Technology, Brainware Group Of Institutions/IT Dept, Birbhum Institute Of Engineering And Technology 4 liking & immensely appreciating our BLOG PROJECTS HUNTER . Thanks so much 4 ur appreciation...v shall definitely try 2 live up on it... Thank u
Post a Comment