private void DeletePatient() { try { //If button is clicked, a messagebox will be shown to make sure that the user wants to delete the patient MessageBoxResult result = MessageBox.Show("Are you sure you want to delete the patient?", "Delete", MessageBoxButton.YesNoCancel, MessageBoxImage.Exclamation, MessageBoxResult.No); if (result == MessageBoxResult.Yes) { rowsAffected = PatientDB.deletePatient(SelectedPatient); Patients.Clear(); DisplayAllPatients(); if (rowsAffected != 0) { MessageBox.Show("Patient Deleted"); } else { MessageBox.Show("Delete Failed"); } } } catch (Exception e) { throw e; } }