[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'StdCtrls' (#lcl)

# TCustomListBox.SelCount

The number of selected items in the list box control.

## Declaration

Source position: stdctrls.pp line 677

`public property TCustomListBox.SelCount : Integer read GetSelCount;`

## Description

SelCount is a read-only Integer property which contains the number of Items selected in the list box control. The property value is the result returned by the GetSelCount method in the widgetset class when its Handle has been allocated.

If the widget Handle is unassigned, the property value is determined using either the value in ItemIndex or the list items in the local cache. If MultiSelect has not been enabled, the property value is either 0 or 1; 0 when ItemIndex = -1 and 1 when ItemIndex > -1. If MultiSelect is True, the local item cache is searched to get the number of items selected in the control. The value is 0 if the local cache is invalid or none of the cached items are in the selected state.

Use Selected to get or set the selected state for an item on the control.

Use SelectRange to set or reset the selected state for Items in a specified range of positions.

Use SelectAll to select all Items in the control.

Use ClearSelection to remove all item selections in the control.

## See also

TCustomListBox.Selected |  | The Selected state for an item in the control.
TCustomListBox.ItemIndex |  | Ordinal position for the currently selected item, -1 if none.
TCustomListBox.Items |  | The list of all items defined in the control.
TCustomListBox.MultiSelect |  | Allows selection of more than one item from the list.
TCustomListBox.SelectRange |  | Changes the selection state for a range of Items in the control.
TCustomListBox.SelectAll |  | Selects all items in the list (in ExtendedSelect mode).
TCustomListBox.ClearSelection |  | Unselects all items in the control.
TCustomListBox.ExtendedSelect |  | True when a contiguous range of items can be selected using Shift+Click. The default value is True.