CListBox::SelItemRange

int SelItemRange( BOOL bSelect, int nFirstItem, int nLastItem );

Return Value

LB_ERR if an error occurs.

Parameters

bSelect

Specifies how to set the selection. If bSelect is TRUE, the string is selected and highlighted; if FALSE, the highlight is removed and the string is no longer selected.

nFirstItem

Specifies the zero-based index of the first item to set.

nLastItem

Specifies the zero-based index of the last item to set.

Remarks

Selects multiple consecutive items in a multiple-selection list box.

Use this member function only with multiple-selection list boxes. If you need to select only one item in a multiple-selection list box — that is, if nFirstIem is equal to nLastItem — call the SetSel member function instead.

Example

// The pointer to my list box.
extern CListBox* pmyListBox;

// Select half of the items.
pmyListBox->SelItemRange(TRUE, 0, pmyListBox->GetCount()/2);

CListBox OverviewClass MembersHierarchy Chart

See Also   LB_SELITEMRANGE, CListBox::GetSelItems