private void cmbMajors_SelectionChangeCommitted(object sender, EventArgs e) { if (cboStudent.SelectedValue != null) { string cboStu = cboStudent.SelectedValue.ToString(); int intStuID = int.Parse(cboStudent.SelectedValue.ToString()); CourseBusiness cb = new CourseBusiness(); List <CoursesTakenPreviously> cp = cb.GetCourseTakenPrev(intStuID); } }
private void cboStudent_SelectedIndexChanged(object sender, EventArgs e) { dg1.DataSource = null; dg1.Rows.Clear(); if (cboStudent.SelectedValue != null) { string cboStu = cboStudent.SelectedValue.ToString(); int intStuID; bool parseOK = Int32.TryParse(cboStudent.SelectedValue.ToString(), out intStuID); if (parseOK) { CourseBusiness cb = new CourseBusiness(); List <CoursesTakenPreviously> cp = cb.GetCourseTakenPrev(intStuID); dg1.DataSource = cp; dg1.Refresh(); } } }