/// <summary> /// On ViewDetails button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnViewDetails_Click(object sender, EventArgs e) { try { if (dgvProductRegister.SelectedRows.Count > 0) { frmProductCreation objfrmProductCreation; decimal decRegister = Convert.ToDecimal(dgvProductRegister.CurrentRow.Cells["dgvtxtproductId"].Value.ToString()); objfrmProductCreation = Application.OpenForms["frmProductCreation"] as frmProductCreation; if (objfrmProductCreation == null) { objfrmProductCreation = new frmProductCreation(); objfrmProductCreation.MdiParent = formMDI.MDIObj; objfrmProductCreation.CallFromProductRegister(decRegister, this); } else { objfrmProductCreation.CallFromProductRegister(decRegister, this); } inCurrenRowIndex = dgvProductRegister.CurrentRow.Index; } } catch (Exception ex) { formMDI.infoError.ErrorString = "PR13:" + ex.Message; } }
/// <summary> /// On doubleclicking the grid, it dispalys productcreation form and fill the correspnding product details to edit or delete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvProductRegister_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1 && e.ColumnIndex > -1) { if (dgvProductRegister.CurrentRow != null) { if (dgvProductRegister.Rows.Count > 0) { if (dgvProductRegister.CurrentRow.Cells["dgvtxtproductId"].Value != null) { if (dgvProductRegister.CurrentRow.Cells["dgvtxtproductId"].Value.ToString() != "") { frmProductCreation objfrmProductCreation; decimal decRegister = Convert.ToDecimal(dgvProductRegister.Rows[e.RowIndex].Cells["dgvtxtproductId"].Value); if (dgvProductRegister.CurrentRow.Index == e.RowIndex) { objfrmProductCreation = Application.OpenForms["frmProductCreation"] as frmProductCreation; if (objfrmProductCreation == null) { objfrmProductCreation = new frmProductCreation(); objfrmProductCreation.MdiParent = formMDI.MDIObj; objfrmProductCreation.CallFromProductRegister(decRegister, this); GridFill(); } else { objfrmProductCreation.CallFromProductRegister(decRegister, this); } if (dgvProductRegister.CurrentRow != null) { inCurrenRowIndex = dgvProductRegister.CurrentRow.Index; } } } } } } } } catch (Exception ex) { formMDI.infoError.ErrorString = "PR12:" + ex.Message; } }