| Chapter 3- Data Types and Operators | Boolean Expressions Page 2 3 4 |
| The If Statement Page 2 3 4 5 6 7 8 9 | |
| Arithmetic Operations Page 2 3 4 5 6 | Boolean Operators and Nested If Statements Page 2 3 4 5 6 7 |
| Events and Sequential Processing Page 2 3 4 5 | More Examples Page 2 3 4 5 6 7 8 9 10 11 12 |
| Datatypes and Conversions Page 2 3 4 5 6 7 | Using Check Box and Option Controls Page 2 3 4 5 6 7 8 9 10 |
| Variable Declarations - Local and Global Page 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Exercises Page 2 3 4 5 6 7 8 |
| Chapter 4- Selection Statements | Review Questions |
| Introduction | |
3-3: Events and Sequential Processing (continued)
Programming the Command Buttons
Next write the code for the click events for the Exit and Clear buttons. Note that because the names of the buttons have been changed the click events will appear as Private Sub btnExit_Click() for example, (rather than Private Sub Button1_Click perhaps) when you double click on the button to open the code for the event.
The Exit button should simply end the program. (Refer to Chapter 2 if you do not remember how to do this.)
The Clear button should remove any values that
are displayed in the textboxes. The best way to do this is to set the values
of the Text properties of the textboxes to null, i.e.
use the named string constant, vbNullString as mentioned
in section 3-2 (pg. 4). Click on the Help icon to read more generally abou
the built-in constants in VB.
Thus you would write
...for each of the textbox objects.
The event that causes most of the computation to be done in this program is the click event for the Calculate button. A click on this button should cause the Year, Interest, and Capital columns of textboxes to fill with the appropriate values.
The first row should contain