Exploring Programming | Academics | Middle School | The American School in Japan

Visual Basic Test, Version A, Spring 2001

For this test, you may use your old programs and the help file in Visual Basic. In the help file, make sure that you have selected Visual Basic Documentation in the Active Subset, then use the index, but not the search.  Choose the level of the test you wish to complete; your score will be based on your successful completion of that level. The grades for the test are:

Level Grade
1 C
2 B-
3 B+
4 A-
5 A

Write and run a program that will accomplish one of the following:

Level Instructions
1 Create a form and caption it Visual Basic Test, Version A. Add two command buttons, one captioned End and one captioned Color. Clicking the End button will end the program, and clicking the Color button will make the form background turn red. See the images below.

 

 Important note: Although you may set the color in several ways, a short-hand notation for red is to make the appropriate property equal to vbRed.

2 Create the same form as level 1, but each click of the Color button causes the form background color to alternate between red and blue (vbBlue)
3 Create the same form as level 3, but add a new command button captioned Stop. Clicking the Color button causes the form to automatically switch between red and its original color every 2 seconds. Clicking the Stop button stops the color cycling. See below.

4 Create the same form as level 3, but add an appropriately labeled text box that will allow a user to input the cycling time in seconds.
5 Create the same form as level 4, but but add option buttons that will allow the user to choose the two colors for the program to alternate between. There must be at least 4 selections for each. Include an option for resetting the form to its original background color.

Hints:  

  1. In Help, go to the index and look at the color constants.
  2. When looking in the reference section, know that an OptionButton is a Visual Basic intrinsic control.
  3. Grouping the option buttons in a frame makes life a lot simpler. In Help, go to the index and type option buttons, default value in the keyword box. You may find the controls.vbp file it references in the O: drive.
  4. In order to share a constant or variable between subprograms, dimension it in the (general) statements of your program.
  5. Don't forget to have the option button frames cycle colors also.

Created May, 2001

Last Maintained 04/09/03
Owner: D. Fincher (dfincher@asij.ac.jp)