private void compCoursesText_SelectedIndexChanged(object sender, EventArgs e) { string id;//stud id id = IDText.Text.ToString(); if (compCoursesText.SelectedItem == null) { return; } //checking if student already registered to the specific course. foreach (string item in MyCourses.Items) { if (item == compCoursesText.GetItemText(compCoursesText.SelectedItem)) { MessageBox.Show("You are already registered to this course!", "ERROR", MessageBoxButtons.OK); return; } } //if not.. //demo version of registering to course..// //Do Draw of the course so student can see hours. ==> #1 //Do available hours of same course. ==> #2 //Do registering.. and save to DB. ==> #3 AddCourseToStudent StudCourseAdd = new AddCourseToStudent(compCoursesText.GetItemText(compCoursesText.SelectedItem), id); StudCourseAdd.ShowDialog(); }
private void OptionCourses_SelectedIndexChanged(object sender, EventArgs e) { if (OptionCourses.SelectedItem == null) { return; } AddCourseToStudent AddCourseToStudent = new AddCourseToStudent(OptionCourses.GetItemText(OptionCourses.SelectedItem).ToString(), IDText.Text.ToString()); AddCourseToStudent.ShowDialog(); }