private void gvLicence_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { if (gvLicence.Rows[e.RowIndex].Cells["Edit"].Value.ToString().Trim() != "") { if (Convert.ToBoolean(gvLicence.Rows[e.RowIndex].Cells["Edit"].Selected) == true) { int SlNo = Convert.ToInt32(gvLicence.Rows[e.RowIndex].Cells[gvLicence.Columns["SlNo"].Index].Value); DataRow[] dr = dtLicence.Select("SlNo=" + SlNo); LicenceDetails objLicenceDetails = new LicenceDetails(dr); objLicenceDetails.objStockPointDetl = this; objLicenceDetails.ShowDialog(); } } if (e.ColumnIndex == gvLicence.Columns["Delete"].Index) { DialogResult dlgResult = MessageBox.Show("Do you want delete this record?", "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlgResult == DialogResult.Yes) { int SlNo = Convert.ToInt32(gvLicence.Rows[e.RowIndex].Cells[gvLicence.Columns["SlNo"].Index].Value); DataRow[] dr = dtLicence.Select("SlNo=" + SlNo); dtLicence.Rows.Remove(dr[0]); GetLiceince(); MessageBox.Show("Selected information Has Been Deleted", "SSCRM Application", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void btnAdd_Lice_Click(object sender, EventArgs e) { LicenceDetails objLicenceDetails = new LicenceDetails(); objLicenceDetails.objStockPointDetl = this; objLicenceDetails.ShowDialog(); }