This documentation is archived and is not being maintained.


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

int SelItemRange(
   BOOL bSelect,
   int nFirstItem,
   int nLastItem 


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.


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


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

LB_ERR if an error occurs.

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 nFirstItem is equal to nLastItem — call the SetSel member function instead.

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

Header: afxwin.h