/* * Deletes a candidate */ private void buttonDelete_Click(object sender, EventArgs e) { if (listBoxCandidate.SelectedIndex != -1) { Candidate candidate = (Candidate)listBoxCandidate.SelectedItem; controller.delete(candidate.Id.ToString()); } else { System.Windows.Forms.MessageBox.Show("You must select a candidate."); } }