Example #1
0
        private void dgvAdvanceRegister_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    frmAdvancePayment frmAdvancePaymentObj = new frmAdvancePayment();
                    frmAdvancePaymentObj.MdiParent = formMDI.MDIObj;

                    frmAdvancePayment open = Application.OpenForms["frmAdvancePayment"] as frmAdvancePayment;

                    if (open == null)
                    {
                        frmAdvancePaymentObj.WindowState = FormWindowState.Normal;
                        frmAdvancePaymentObj.MdiParent   = formMDI.MDIObj;

                        decGrid = Convert.ToDecimal(dgvAdvanceRegister.Rows[e.RowIndex].Cells["advancePaymentId"].Value.ToString());
                        frmAdvancePaymentObj.CallFromAdvanceRegister(decGrid, this);
                    }
                    else
                    {
                        open.MdiParent = formMDI.MDIObj;
                        open.BringToFront();
                        decGrid = Convert.ToDecimal(dgvAdvanceRegister.Rows[e.RowIndex].Cells["advancePaymentId"].Value.ToString());
                        open.CallFromAdvanceRegister(decGrid, this);

                        if (open.WindowState == FormWindowState.Minimized)
                        {
                            open.WindowState = FormWindowState.Normal;
                        }
                    }
                    inCurrenRowIndex = dgvAdvanceRegister.CurrentRow.Index;
                    this.Enabled     = false;
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "AR9:" + ex.Message;
            }
        }