private void Form2_Load(object sender, EventArgs e) { try { StudentBusiness sb = new StudentBusiness(); List <Student> MList = sb.GetAllStudents(); cboStudent.DataSource = MList; cboStudent.ValueMember = "StudentID"; cboStudent.DisplayMember = "StudentID"; cboStudent.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Form5_Load(object sender, EventArgs e) { try { CourseBusiness cb = new CourseBusiness(); StudentBusiness sb = new StudentBusiness(); List <int> SList = sb.GetStudentEnrolledIDs(); noDupSList = SList.Distinct().ToList(); cboStudents.DataSource = noDupSList; cboStudents.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void cboCourses_SelectedIndexChanged(object sender, EventArgs e) { dg2.DataSource = null; dg2.Rows.Clear(); if (cboCourses.SelectedValue != null) { string cboCo = cboCourses.SelectedValue.ToString(); int intCourseNum; lblTest.Text = "No"; bool parseOK = Int32.TryParse(cboCourses.SelectedValue.ToString(), out intCourseNum); lblTest.Text = "Yes"; StudentBusiness sb = new StudentBusiness(); List <Student> studenList = sb.GetEnrollment(cboCo); dg2.DataSource = studenList; dg2.Refresh(); } }