Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

Check Boxes

Figure 11.5 shows a form with check boxes. The Check Box control works just like the option button, with two differences: A selected check box shows the selection with a check mark, and check boxes are never mutually exclusive. Therefore, the user can select one or more check boxes even if those check boxes reside in the same frame or on the same form.

11fig05.gif

Figure 11.5 A Form with two check boxes.

The Check Box control supports the same fundamental properties as the option button, except that the Value property determines not only if the box is checked (if 1) or unchecked (if 0), but also if it is grayed (if the Value property contains 2). Users sometimes use a grayed check box to determine whether part of a selected option is true. In addition, the programmer may gray out a box to show that the selection is unavailable under the current conditions.

Visual Basic version 5 added a new Style value to the Check Box control's property list. The available Style property values are 0-Standard and 1-Graphical. The graphical style value makes the check box look a lot like a command button that stays pressed (when selected) or unpressed (when not selected).

Figure 11.6 shows a form that illustrates the various Check Box property options available to you.

11fig06.gif

Figure 11.6 Some Check Box control property options.

Share ThisShare This

Informit Network