public void ViewGridDetails() { bool isFromRegister = false; try { if (dgvRejectionInRegister.CurrentRow != null) { isFromRegister = true; decimal decMasterId = Convert.ToDecimal(dgvRejectionInRegister.CurrentRow.Cells["dgvtxtRejectionInMaterId"].Value.ToString()); frmRejectionIn frmRejectionInObj = new frmRejectionIn(); frmRejectionIn frmRejectionInOpen = Application.OpenForms["frmRejectionIn"] as frmRejectionIn; if (frmRejectionInOpen == null) { frmRejectionInObj.MdiParent = formMDI.MDIObj; frmRejectionInObj.CallFromRejectionInRegister(this, Convert.ToDecimal(dgvRejectionInRegister.CurrentRow.Cells["dgvtxtRejectionInMaterId"].Value.ToString()), isFromRegister); } else { frmRejectionInOpen.CallFromRejectionInRegister(this, Convert.ToDecimal(dgvRejectionInRegister.CurrentRow.Cells["dgvtxtRejectionInMaterId"].Value.ToString()), isFromRegister); frmRejectionInOpen.MdiParent = formMDI.MDIObj; frmRejectionInOpen.BringToFront(); if (frmRejectionInOpen.WindowState == FormWindowState.Minimized) { frmRejectionInOpen.WindowState = FormWindowState.Normal; } } } } catch (Exception ex) { formMDI.infoError.ErrorString = "RIREG5:" + ex.Message; } }