public void LoadEnrollCourseComboBox() //function to load the CourseID column values into the combobox. This function is called as soon as the EnrollForCourse Window is opened. { try { EnrollCourseComboBox.ItemsSource = studentBL.GetCoursesAsList(); EnrollCourseComboBox.SelectedValuePath = "CourseID"; EnrollCourseComboBox.DisplayMemberPath = "Name"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }