private void LoadDepartments() { departmentBusinessComponent = new DepartmentBusinessComponent(); var departments = departmentBusinessComponent.FetchDepartments(); if (departments != null && departments.Count > 0) { comboBoxDepartments.DataSource = departments; comboBoxDepartments.DisplayMember = "DepartmentName"; } else { MessageBox.Show("no department records found"); } }
private void EmployeeRecordsForm_Load(object sender, EventArgs e) { dgvEmployees.AutoGenerateColumns = false; try { departmentBusinessComponent = new DepartmentBusinessComponent(); var departments = departmentBusinessComponent.FetchDepartments(); if (departments != null && departments.Count > 0) { comboBoxDepartments.DataSource = departments; comboBoxDepartments.DisplayMember = "DepartmentName"; } else { MessageBox.Show("no department records found"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }