Advanced Visual Basic 2010 Programming Challenge 7 Student Course Collection
Create an application that collects information about students and the courses they have completed, and holds this information in collection, implemented as a List or ArrayList object. You can use Tutorial 3-2 as a starting point for this project. The main form, displayed when the application starts, should have the same fields as shown in the tutorial.
A sample of the main form is shown in Figure 3-26.
In addition, do the following:
• Create a class named Course with the following properties: CourseId As String, Credits As Integer, Grade As Double.
• Add a class-level variable to the Student class that holds a list of courses.
• Create a new form named Course Information that contains the following input
fields: course ID, credits, and grade. A sample is shown in Figure 3-27. The list box displays all courses in the student’s transcript.
• On the main form, add a Course Information button. Use this button to display the Course Information form. The button should initially be disabled; it is enabled when the user clicks either the Add to Collection button or the Find by ID button.
The following input requirements are designed to prevent the program from throwing an exception or storing invalid data:
1. No two Student IDs can be the same.
2. No input fields can be blank.
3. The Grade field must be a positive numeric value between 0.0 and 4.0.
4. The course credits field must be a positive integer between 0 and 6.
5. A duplicate course number cannot be added to the list of courses.
6. Error messages must be specific, identifying exactly which field has a missing or incorrect value.
Each of these requirements is included in the testing steps that we have outlined for this programming challenge.
1. In the main form, create a class-level variable of type Student so it can be accessible to different event handlers. This will affect the event handlers for both the Add and Find buttons.
2. The Student class should have a ReadOnly property that exposes its ArrayList. This will be useful when your program needs to display the courses in a list box or add a new course to the list.
3. The Form_Load event handler for the Course Information form should fill the list box with the list of courses belonging to the current student. It should also clear all text boxes on the form.
4. Use the ErrorProvider control to display error messages.