가. 언어유형/C#

부모창에서 자식창 중복으로 안뜨게 하기

LemonDory 2008. 10. 10. 15:31
   
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (GetForm("Incident") == false)
            {
                Incident incidentForm = new Incident();
                incidentForm.MdiParent = this;
                incidentForm.Show();
            }
        }
        public Boolean GetForm(String SearchForm)
        {
            foreach (Form frmChildForm in this.MdiChildren)
            {
                if (frmChildForm.Name == SearchForm)
                {
                    frmChildForm.Activate();
                    return true;
                    break;
                } 
            }
            return false;
        }