Step 3: Check Boxes

When displaying Boolean (True/False) values, you have the option of using check boxes instead of True/False strings or 1/0 values. This has the advantage of preventing users from entering bad values.

Column 4 (Bonus) contains Boolean values (either someone gets a bonus or not). To display the values as checkboxes, set the ColDataType property to flexdtBoolean. The control will automatically display and manage the check boxes.

The ColDataType property must be assigned at run time. Change the Form_Load routine as shown below:

    Private Sub Form_Load()

   

        ' format column 3 (Amount Sold) to display currency

        fg.ColFormat(3) = "$#,###.00"

   

        ' make column 4 (Bonus) a Boolean column

        fg.ColDataType(4) = flexdtBoolean

   

    End Sub

Users may toggle the check boxes by clicking them or by selecting them with the keyboard and then hitting ENTER or SPACE. Press F5 to run the project again, then type a few sales amounts and give bonuses to some people.