Computer Science 275.001

Interaction Programming

Fall 2006

Visual Basic

Programming Assignment #2

Due: Tuesday, September 12, 2006

(Due in drop-box by 1:00 PM)

 

(zipped files)

 

 


Your second VB2005 assignment in this course deals with additional interface controls,
including checkboxes, list-boxes, and containers, as well as control visibility and resizing.
The single form in this application will display a list of Computer Science courses
retrieved from an external file.
When the user selects one of the courses, details about that course will be displayed in
various controls on the form, including labels (for the course number, title, and
description), buttons (for the course prerequisites), and picture-boxes (for the images
of the course’s required textbooks).
Additional event-handling will be implemented for the prerequisite buttons (i.e., clicking
one of them causes the corresponding course to be selected from the list, assuming that the
prerequisite course is in the list) and for the textbook-display checkbox (which toggles
whether or not the panel containing the textbook images will be displayed).
The form will have the structure displayed below:

Note that this design involves the following event handlers:

Ÿ         Selecting from the listbox: the selected course’s information (number, title, description, prerequisites, and – if the checkbox is checked – textbook images) should be displayed appropriately.

Ÿ         Clicking one of the prerequisite buttons: one event-handler should suffice for all four buttons, with the text of the clicked button used to determine which item in the listbox should be selected.

Ÿ         Toggling the checkbox: collapsing the right panel and reducing the form’s width if the checkbox is checked, reversing these actions if the checkbox is unchecked.

Ÿ         Clicking the exit button: terminating the application.


Programming Guidelines:

·         Set up a Course structure with fields representing the primary data items associated with a CS course (a string for the course number, a string for the course description, a string array for the prerequisites, a string array for the names of its textbook files, etc.). The form should have a data member that is an array of Course objects.

·         Use global constants where appropriate (e.g., the form’s width when the textbooks are or are not displayed, the name of the SIUE logo image file).

·         Use arrays of controls where appropriate (e.g., the prerequisite buttons, the textbook picture-boxes).

·         Modularize your code. For instance, when the form is initially loaded, the array of Course objects must be created from the external file, each course must have its textbook filenames determined, and the listbox must be filled with the course numbers. Each of these activities should be handled by a separate sub-procedure.

·         Make sure to document your code adequately. Place an explanatory paragraph, including your name, at the top of your file. Also, place an explanatory sentence before each function, sub-procedure, structure, and class in your program. Finally, place a small explanatory in-line comment before any code that is especially complicated or difficult to comprehend by mere reading.

Odds and Ends

The text and image files that you need for this assignment are available on the department server at:

Engineering/Classes/Fall 2006/CS/CS275/Assignments/VBPA2

Note that the course information in the text file CourseListings.txt is formatted as follows: the course number on a line by itself, then the course title on a line by itself, then the course description on a line by itself, then at most four prerequisite course numbers, each on a line by themselves, and finally a blank line.

The image file for the SIUE logo is SIUElogo.gif, while the textbook images are in the Textbooks folder with names corresponding to the course number (e.g., the textbook images for CS 275 are CS275_1.jpg and CS275_2.jpg). You will need to use string operations and the IO.File.Exists function to determine which textbook images are associated with each course.

Remember that your entire project folder is due on your drop-box by 1:00 PM on Tuesday, September 12, 2006.