private void ribbonButton4_Click(object sender, EventArgs e) { foreach (Form f in this.MdiChildren) { if (f is FormSMSGuru) { //MessageBox.Show("Form2 is already opened."); return; } } CloseMdiForm(); _guru_sms = new FormSMSGuru(); _guru_sms.MdiParent = this; _guru_sms.textBox2.Text = port; _guru_sms.Show(); }