private void NewStudent_Load(object sender, EventArgs e) { using (DefinitionService definitionService = new DefinitionService()) { cmbBranch.DataSource = definitionService.GetBranches(); cmbBranch.DisplayMember = "BranchName"; cmbBranch.ValueMember = "BranchId"; } using (DefinitionService definitionService = new DefinitionService()) { cmbCourse.DataSource = definitionService.GetCourses(); cmbCourse.DisplayMember = "CourseName"; cmbCourse.ValueMember = "CourseId"; } using (DefinitionService definitionService = new DefinitionService()) { cmbFaculty.DataSource = definitionService.GetFaculties(); cmbFaculty.DisplayMember = "FacultyName"; cmbFaculty.ValueMember = "FacultyId"; } }