private void DeleteNote() { if (dataGridView1.SelectedRows.Count > 0) { int selectedRowIndex = dataGridView1.SelectedCells[0].RowIndex; int Id = (int)dataGridView1.Rows[selectedRowIndex].Cells[0].Value; if (MessageBox.Show("Are you sure you wanted to delete this entry?", "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SupervisorNotesModel deleteId = new SupervisorNotesModel() { Id = Id }; PrepAndPaintDB.DeleteSuperVisorNote(deleteId); } GetInfo(); } else { MessageBox.Show("Sorry you need to select an entry to delete!", "Error", MessageBoxButtons.OK); } }