private void PlannerListBox_Delete(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure?", "Delete planner confirmation", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { try { DbAdapter.DeletePlanner(this.Participant.Name, PlannerListBox.SelectedItem.ToString()); AdjustPlannerListBox(); } catch (Exception exception) { MessageBox.Show(exception.Message); } } }