private void REMOVE_Click(object sender, RoutedEventArgs e)//remove { int ID; try { MessageBoxResult result = MessageBox.Show("You really want to delete this employee", "Warning", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); switch (result) { case MessageBoxResult.Yes: { int.TryParse(comboBox.SelectedItem.ToString(), out ID); if (bl.AllCONTRACT_TO_employee(ID).Count() != 0) //verifie if he has a contract { throw new Exception("this employee has got a contract"); } bl.removeEmployee(ID); showDataGridView(); break; } case MessageBoxResult.No: break; } } catch (Exception ex) { showDataGridView(); MessageBox.Show(ex.Message); } }