Retrieves or sets the cell's state. Has effect only for check and radio cells.
Type | Description | |||
Item as Variant | A long expression that indicates the item's handle that indicates the owner of the cell. | |||
ColIndex as Variant | A long expression that identifies the column's index, or a string expression that specifies the column's caption or the column's key. | |||
Long | A long value that indicates the cell's state. |
The CellState property has effect only for check and radio cells. When the cell's state is changed the control fires the CellStateChanged event. Use the FilterType property on exCheck to filter for checked or unchecked items.
The following sample shows how to change the state for a cell to checked state: Group.Items.CellState(Group.Items(0), 0) = 1,
The following sample shows how to change the state for a cell to unchecked state: Group.Items.CellState(Group.Items(0), 0) = 0,
The following sample shows how to change the state for a cell to partial checked state: Group.Items.CellState(Group.Items(0), 0) = 2
The following sample displays a message when a cell of radio or check type has changed its state:
Private Sub ExplorerTree1_AddItem(ByVal Group As EXPLORERTREELibCtl.IGroup, ByVal Item As EXPLORERTREELibCtl.HITEM) With Group.Items .CellHasCheckBox(Item, 0) = True End With End Sub Private Sub ExplorerTree1_CellStateChanged(ByVal Group As EXPLORERTREELibCtl.IGroup, ByVal Item As EXPLORERTREELibCtl.HITEM, ByVal ColIndex As Long) Debug.Print "The cell """ & Group.Items.CellCaption(Item, ColIndex) & """ has changed its state. The new state is " & IIf(Group.Items.CellState(Item, ColIndex) = 0, "Unchecked", "Checked") End Sub
Note: A cell is the intersection of an item with a column. All properties that has an Item and a ColIndex parameters are referring to a cell. The Item parameter represents the handle of an item, and the ColIndex parameter indicates an index ( a numerical value, see Column.Index property ) of a column , the column's caption ( a string value, see Column.Caption property ), or a handle to a cell. Here's few hints how to use properties with Item and ColIndex parameters:
Group.Items.CellBold(, Group.Items.ItemCell(Group.Items(0), 0)) = True Group.Items.CellBold(Group.Items(0), 0) = True Group.Items.CellBold(Group.Items(0), "ColumnName") = True