| 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-7: Check Box and Option Controls
Exercise 4-6: Global Classics Cinema continued ...
We would like to cause the program to display the groupbox of movie times after the user has clicked on any movie radio button.
In the design window double click the first movie radio button and the code window opens displaying the template for the Click event for that radio button ... something like this ...
Private Sub rdoMovie1_CheckedChanged(ByVal sender As System.Object, _We need to understand better what this syntax for the event template is telling us so that we can modify it appropriately.
It says that the Sub named rdoMovie1_CheckedChanged Handles the rdoMovie1_CheckedChanged event! (We'll continue to gloss over the parameter list for now.)
There is nothing special about the Sub name being rdoMovie1_CheckedChanged. We could change it to
Private Sub rdoXXX(ByVal sender As System.Object, _if we wanted to (although such a name is not very informative to the human reader of the program!). What is important is the
Handles rdoMovie1.CheckedChangedpiece. It means that this Sub, no matter what its name is, responds when the CheckedChanged event of the rdoMovie1 radio button occurs. This name following the Handles keyword is important; it must be a correct name for an event of an object. In this case it is the event that occurs when the user clicks on a radio button, i.e. the CheckedChanged event.
Choosing a more sensible name for the Sub we could also write here:
Private Sub rdoMovie_Chosen(ByVal sender As System.Object, _specifying that the one Sub should respond not only to the CheckedChanged event of the rdoMovie1 radio button, but also to the CheckedChanged events of the rdoMovie2 radio button, the rdoMovie3 radio button, and the rdoMovie4 radio button!
Now this one sub will respond, i.e. be executed, whenever any of the radio buttons for selecting a movie is pressed. And what it must do, of course, is make the groupbox containing the movie times visible, as in:
Private Sub rdoMovie_Chosen(ByVal sender As System.Object, _