private void edit_participant_paid(bool paid) { RegistrationHelper client = new RegistrationHelper(); try { ParticipantWithName p = (ParticipantWithName)lstParticipants.SelectedItem; client.EditParticipant(p.participant.ParticipantID, paid); loadParticipants(); MessageBox.Show("Operation succeeded!"); lstParticipants_SelectionChanged(null, null); for (int i = 0; i < lstParticipants.Items.Count; i++) { ParticipantWithName part = (ParticipantWithName)lstParticipants.Items[i]; if (part.participant.ParticipantID == p.participant.ParticipantID) { lstParticipants.SelectedIndex = i; return; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { client.Close(); } }