private void DeleteAnimal_Clicked(object sender, RoutedEventArgs e) { if (listBoxAllAnimals.SelectedItem != null) { try { DbConnectionManager.DeleteAnimal(listBoxAllAnimals); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { ShowAllAnimals(); textAnimal.Text = ""; } } else { MessageBox.Show("Please select animal to delete"); } }