private void btnDelete_Click(object sender, EventArgs e) { if (dgvParticipants.SelectedRows.Count == 0) { MessageBox.Show("Choose a participant"); return; } if (MessageBox.Show("Are you sure?", "Delete participant", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Participant selectedParticipant = (Participant)dgvParticipants.SelectedRows[0].DataBoundItem; _viewModel.DeleteParticipant(selectedParticipant); } }