CListBox::GetSel
intGetSel(intnIndex**)const;**
Return Value
A positive number if the specified item is selected; otherwise, it is 0. The return value is LB_ERR if an error occurs.
Parameters
nIndex
Specifies the zero-based index of the item.
Remarks
Retrieves the selection state of an item. This member function works with both single- and multiple-selection list boxes.
Example
// The pointer to my list box.
extern CListBox* pmyListBox;
// Dump all of the items select state.
#ifdef _DEBUG
CString str;
for (int i=0;i < pmyListBox->GetCount();i++)
{
str.Format(_T("item %d: select state is %s\r\n"),
i,
pmyListBox->GetSel( i ) > 0 ? _T("true") : _T("false"));
afxDump << str;
}
#endif
CListBox Overview | Class Members | Hierarchy Chart
See Also , CListBox::SetSel