private void btnNew_Click(object sender, EventArgs e) { CombiMaster objCombiMaster = new CombiMaster(); objCombiMaster.objCombiProdList = this; objCombiMaster.ShowDialog(); }
private void gvCombiProductDetails_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { string sCombiId = gvCombiProductDetails.Rows[e.RowIndex].Cells["CombiId"].Value.ToString(); if (e.ColumnIndex == 3) { CombiMaster combiMas = new CombiMaster(sCombiId); combiMas.objCombiProdList = this; combiMas.ShowDialog(); } if (e.ColumnIndex == 4) { DialogResult dlgResult = MessageBox.Show("Do you want Delete this Record?", "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlgResult == DialogResult.Yes) { DataGridViewRow dgvr = gvCombiProductDetails.Rows[e.RowIndex]; gvCombiProductDetails.Rows.Remove(dgvr); MessageBox.Show("Data Deleted Successfully", "Combi Master", MessageBoxButtons.OK, MessageBoxIcon.Information); if (gvCombiProductDetails.Rows.Count > 0) { for (int i = 0; i < gvCombiProductDetails.Rows.Count; i++) { gvCombiProductDetails.Rows[i].Cells["SlNo"].Value = (i + 1).ToString(); } } } else { MessageBox.Show("Data Not Deleted", "Combi Master", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }