Presentation is loading. Please wait.

Presentation is loading. Please wait.

Controls for Choices. Let’s look at a couple of new controls: option buttons and check boxes These controls are designed to be used when you want the.

Similar presentations


Presentation on theme: "Controls for Choices. Let’s look at a couple of new controls: option buttons and check boxes These controls are designed to be used when you want the."— Presentation transcript:

1 Controls for Choices

2 Let’s look at a couple of new controls: option buttons and check boxes These controls are designed to be used when you want the user of the program to have choices We’ll use conditionals to determine which values have been set and have the program act accordingly

3 Option Buttons Option buttons come in groups. Only one button in the group can be selected. We use the prefix opt for this control. Let’s say there are three buttons in a group for choosing a size, Small, Medium, or Large We can name our buttons optSmall, optMedium, and optLarge

4 Creating Option Buttons Choose the Option Button tool in the Toolbox and create as many as you want in a group Choose a frame from the Toolbox Put a frame around the option buttons in the group Name the buttons and change their text You are now ready to use them in a program

5 Check Boxes Check boxes are like option buttons but differ in that more than one in a group can be checked While option buttons make sense for choosing something like model or color, check boxes can be used for choosing something like features, where more than one can be chosen (AC, disk brakes, super sound package, leather seats, fancy wheels, etc.)

6 Creating Check Boxes It’s the same procedure as for option buttons, but the frame is optional The logic of the associated conditional will be different since more than one can be checked We’ll use the prefix chk for this control

7 OptionDemo: If statements, check boxes, option buttons

8 About the Demo Notice that we check if an option or check box’s Value is True to see if it is selected: If chkTaller.Value = True Then btnPush.Height = btnPush.Height * 2 End If

9 Events Checking a box or selecting a button is an event. But if there is no code for an event, nothing happens There is no code for the event of selecting the red, blue, and green buttons. Their values are checked during the btnPush click event There is code for selecting the white and yellow buttons. That is why the color changes right away when you select them


Download ppt "Controls for Choices. Let’s look at a couple of new controls: option buttons and check boxes These controls are designed to be used when you want the."

Similar presentations


Ads by Google