public void deleteMessageToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to delete this record?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string MsgId = dataGrid.SelectedRows[0].Cells[0].Value.ToString(); SystemMessage.DeleteRecord(FileName, MsgId); populateGridWithMessage(FileName); } }
private void deleteRecordToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to delete this record?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DataGridViewRow row; if (messageGrid.SelectedRows.Count != 0) { row = messageGrid.SelectedRows[0]; } else { row = messageGridOld.SelectedRows[0]; } string MsgId = row.Cells[0].Value.ToString(), MsgDesc = row.Cells[1].Value.ToString(); SystemMessage.DeleteRecord(FileName, MsgId, systemBackup); InitMessageGrid(FileName); Replace(MsgId, MsgDesc); } }