Class #16 Lecture
Read & discuss the "Guidelines for Declaring Variables and Constants" on p. 216 as a class
Ch. 7 Lecture (loops)
Review Ch. 7 Demo Programs
(if time) Do selected Ch. 7, Worksheet #1 & Ch. 7, Worksheet #2 exercises
(if time) Ch. 7 Programming Activity #1:
1. Make a combo box and name it cboNames.
2. Set the Style property as dropdown combo.
3. Add your name to the List property in Design time.
4. Type Control + Enter in the List property and add the second item "John Doe".
5. Set the Text property as "Student Names".
6. Resize the combo box so the whole Text property is displayed on the form.
7. Create a command button and a label.
8. Make the number of items in the combo box appear in the label when the command button is clicked.
9. Execute your program.
10. Create another command button that uses the AddItem method to add the name "Santa Claus" to the combo box when it is clicked.
11. Execute your program and click the second command button. Then, click the first command button to see how many items are now in the combo box.
12. Add a third command button that uses a For/Next loop to change all of the items in the combo box to "Groucho Marx" one at a time. (Hint: Use the List property of the combo box - cboNames.List(j) = "Groucho Marx" where j is your loop variable. Be careful to start your loop at 0 and to choose the correct terminating value.
13. Execute your program, click the first command button, then the second, and then the third command button. Then, click the dropdown triangle to see "Groucho Marx" listed three times.
I will tell you where the online solution can be found at the end of class.
(if time) Ch. 7 Programming Activity #2:
1.Write a program that contains a command button named cmdCount with the Caption property "Loop iterations".
2. Place the code for any For/Next loop from Ch. 7, Worksheet #1 inside of cmdCount's Click event procedure and cause the loop variable's final value to be displayed in a label named lblFinalValue. Be sure to declare any necessary variables.
3. After you desk-check and complete the exercises on Ch. 7, Worksheet #2, test each answer by placing the appropriate code in cmdCount's Click event procedure.
(if time) Ch. 7 Programming Activity #3:
1. Create a project that displays an initial splash screen and that has a form with three command buttons and three labels. The values of three separate variables are incremented by clicking each button. Make the variables, local, module-level, and Static. Observe the running totals of the variables by clearing them occasionally with a fourth Clear button.
CIS 230 Home Page | Mr. Minich's Education Home Page | Minich.com Web Design