| 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 | |
4-3: If Statements
Exercise 4-2: Number Guessing Game (continued ...)
The Check It Button Event Code
The event for this button should assign the value entered by the user in the Guess textbox to an Integer variable. This value should then be compared to the randomly chosen value. If it is less than the random value the Text property of the feedback label should be changed to read Oops - too small. If it is greater the Text property of the feedback label should be changed to read Oops - too large, and if it is equal the Text property should read Hey - you guessed it!.
Itemising this more explicitly, the program statements are
So add this event code to your project, and also program the Exit button event. Test the program and correct it if necessary.