//courseListBox selected index change private void courseListBox_SelectedIndexChanged(object sender, EventArgs e) { selectedCourse = courseListBox.SelectedItem as Course; }
private void scheduleCourseListBox1_SelectedIndexChanged(object sender, EventArgs e) { selectedCourse = scheduleCourseListBox1.SelectedItem as Course; }
public universityRegistrationApp() { InitializeComponent(); scheduleCourseListBox1.Enabled = false; addCourseToScheduleButton.Enabled = false; //Load Courses Course CIS105 = new Course("CIS", "105", "Computer Appls & Info Technology", 10, "9:00am", "T TH", 1, null); Course CIS235 = new Course("CIS", "235", "Intro to Information Systems", 6, "10:30am", "T TH", 2, null); Course CIS340 = new Course("CIS", "340", "Bus Info Systems Devlopment I", 3, "12:00pm", "T TH", 3, new string[] { "CIS 105", "CIS 235" }); Course CIS345 = new Course("CIS", "345", "Bus Info Systems Devlopment II", 3, "4:30am", "T TH", 4, new string[] { "CIS 105", "CIS 235", "CIS 340" }); Course CIS365 = new Course("CIS", "365", "Business Database Systems", 3, "9:00am", "T TH", 5, new string[] { "CIS 105", "CIS 235" }); Course CIS425 = new Course("CIS", "425", "Electronic Commerce Strategy", 4, "9:00am", "M W F", 6, new string[] { "CIS 105", "CIS 235", "CIS 340", "CIS 345" }); Course CIS435 = new Course("CIS", "430", "Networks/Distributed Systems", 4, "10:30am", "M W F", 7, new string[] { "CIS 105", "CIS 235", "CIS 340", "CIS 345", "CIS425" }); Course CIS440 = new Course("CIS", "440", "Systems Design/Electronic Commerce", 4, "12:00pm", "M W F", 8, new string[] { "CIS 105", "CIS 235", "CIS 340", "CIS 345", "CIS425", "CIS 430" }); Course WPC101 = new Course("WPC", "101", "Student Success in Business", 1, "9:00am", "M W F", 9, null); Course WPC301 = new Course("WPC", "301", "Business Forum", 3, "10:30am", "M W F", 10, new string[] { "WPC 101", "ENG 102" }); Course ENG102 = new Course("ENG", "102", "First-Year Composition", 1, "9:00am", "M W", 11, null); Course ECN211 = new Course("ECN", "211", "Macroeconomic Principles", 2, "6:00pm", "M W", 12, null); Course ECN212 = new Course("ECN", "212", "Microeconomic Principles", 2, "6:00pm", "M W", 13, null); Course FIN300 = new Course("FIN", "300", "Fundamentals of Finance", 3, "9:00am", "M W", 14, new string[] { "WPC 101", "ENG 102" }); Course MKT300 = new Course("MKT", "300", "Org & Mgt Leadership", 3, "9:00am", "M W", 0, new string[] { "WPC 101", "ENG 102" }); //Add each course to courseList courseList.Add(CIS105); courseList.Add(CIS235); courseList.Add(CIS340); courseList.Add(CIS345); courseList.Add(CIS365); courseList.Add(CIS425); courseList.Add(CIS435); courseList.Add(CIS440); courseList.Add(WPC101); courseList.Add(WPC301); courseList.Add(ENG102); courseList.Add(ECN211); courseList.Add(ECN212); courseList.Add(FIN300); courseList.Add(MKT300); //Load courseList into courseComboBox for student form //studentCourseHistoryComboBox.DataSource = courseList; //Load courseList into courseComboBox for course form //courseFormCourseHistoryComboBox.DataSource = courseList; //courseListBox.DataSource = courseList; foreach (Course c in courseList) { studentCourseHistoryComboBox.Items.Add(c); courseFormCourseHistoryComboBox.Items.Add(c); courseListBox.Items.Add(c); scheduleCourseListBox1.Items.Add(c); } // Pupulate courseListBox //PopulateCourseData(); // Load students from csv file string[] data; // if file exist then read the data if (File.Exists("studentFile.csv")) { FileStream fs = new FileStream("studentFile.csv", FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); string line = sr.ReadLine(); while (line != null) { data = line.Split(','); Student tempStudent = new Student(data[0], data[1], data[2], Convert.ToDouble(data[3]), Convert.ToBoolean(data[4]), Convert.ToInt32(data[5]), data[6].Split(';')); studentList.Add(tempStudent); line = sr.ReadLine(); } sr.Close(); fs.Close(); //Populate studentListBox populateStudentData(); } }