private void AddButton_Click(object sender, EventArgs e) { if (DepartmentNameTextBox.Text == "") { MessageBox.Show("Please, enter a department name."); } else { int r = controllerObj.A_AddDepartment(DepartmentNameTextBox.Text.ToString()); if (r > 0) { MessageBox.Show("Department added successfully."); DataTable dt1 = controllerObj.SelectDepIDsNames(); DepartmentsComboBox.DataSource = dt1; DepartmentsComboBox.DisplayMember = "Name"; DepartmentsComboBox.ValueMember = "DepID"; } else { MessageBox.Show("Error in adding department."); } } }