CellChecked Property

Returns or sets whether a grid cell has a check mark in it.

Syntax

[form!]VSFlexGrid.CellChecked[ = CellCheckedSettings ]

Remarks

Valid settings for the CellChecked property are:

 

Constant

Value

Description

FlexNoCheckbox

0

The cell has no check box. This is the default setting.

FlexChecked

1

The cell has a check box that is checked.

FlexUnchecked

2

The cell has a check box that is not checked.

FlexTSChecked

3

Tri-state Checked (when clicked, changes state to FlexTSGrayed)

FlexTSGrayed

4

Tri-state Grayed (when clicked, changes state to FlexTSUnchecked)

FlexTSUnchecked

5

Tri-state Unchecked (when clicked, changes state to FlexTSChecked)

 

If the cell has a check box and the Editable property is set to True, the user can toggle the check boxes by clicking them with the mouse or by hitting the SPACE or RETURN keys on the keyboard. Either way, the AfterEdit event is fired after the toggle so you can take appropriate action.

The FlexTSChecked and FlexTSUnchecked settings cause the grid to display checked and unchecked boxes that are identical to the FlexChecked and FlexUnchecked. The difference is that the former are tri-state settings. They cause the check box to cycle through checked, grayed, and unchecked states instead of simply toggling between checked and unchecked.

The check box may appear on the left, right, or center of the cell, depending on the setting of the CellPictureAlignment property.

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property. To set check box values of an arbitrary range of cells (not necessarily the current selection), use the Cell property instead.

For example, the following code makes column 1:

    Private Sub Form_Load()

        Dim r&

        For r = fg.FixedRows To fg.Rows – 1

            fg.Cell(flexcpChecked, r, 1) = flexUnchecked

            fg.Cell(flexcpText, r, 1) = "Row " & r

        Next

        fg.Editable = flexEDKbdMouse

    End Sub

    

    Private Sub Command1_Click()

        Dim r&

        For r = fg.FixedRows To fg.Rows - 1

            If fg.Cell(flexcpChecked, r, 1) = flexChecked Then

                Debug.Print fg.TextMatrix(r, 1); " is Checked"

            End If

        Next

    End Sub

Data Type

CellCheckedSettings (Enumeration)

See Also

VSFlexGrid Control