private void Delete_Button_Click(object sender, RoutedEventArgs e) { if (SupplierListBox.SelectedItem.ToString() != "" && SupplierListBox.SelectedItem.ToString() != "Pick a Supplier") { MessageBoxResult result = MessageBox.Show("Are you sure you want to delete this supplier?", "Supplier Delete Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No); if (result == MessageBoxResult.Yes) { //delete supplier string query = "Delete from `supplier` WHERE supplierName = '" + SupplierListBox.SelectedItem.ToString() + "';"; DatabaseManagement.Delete(query); MessageBox.Show("Supplier has been deleted succesfully", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); } } }