/// <summary> /// On 'CopyData' button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCopyData_Click(object sender, EventArgs e) { try { this.Close(); frmCopyData frmCopyData = new frmCopyData(); frmCopyData _isOpen = Application.OpenForms["frmCopyData"] as frmCopyData; if (_isOpen == null) { frmCopyData.WindowState = FormWindowState.Normal; frmCopyData.MdiParent = formMDI.MDIObj; frmCopyData.Show(); } else { _isOpen.MdiParent = formMDI.MDIObj; if (_isOpen.WindowState == FormWindowState.Minimized) { _isOpen.WindowState = FormWindowState.Normal; } if (_isOpen.Enabled) { _isOpen.Activate(); _isOpen.BringToFront(); } } } catch (Exception ex) { MessageBox.Show("SPIns:3" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }