// Edit student method private void EditStudent() { // Locating the student that the user has highlighted ClsStudent lcStudent = (ClsStudent)LstStudents.SelectedItem; // If student details is not null and editing was successful if (lcStudent != null && lcStudent.ViewEdit()) { // Then update display UpdateDisplay(); } }
// Create student method private void CreateStudent() { // We create a new student by calling the factory method NewStudent() in ClsStudent and storing it in the local variable lcStudent ClsStudent lcStudent = ClsStudent.NewStudent(CboStudentType.SelectedIndex); // If it was successful if (lcStudent != null && lcStudent.ViewEdit()) { // We add the student to the student list // V5 edit, as we are using a dictionary this changes a little compared to the list one ClsInstitute.StudentList.Add(lcStudent.ID, lcStudent); // Then update the display to show the student in the list box UpdateDisplay(); } }