CComboBox::GetCurSel

int GetCurSel( ) const;

Return Value

The zero-based index of the currently selected item in the list box of a combo box, or CB_ERR if no item is selected.

Remarks

Call this member function to determine which item in the combo box is selected. GetCurSel returns an index into the list.

Example

// The pointer to my combo box.
extern CComboBox* pmyComboBox;

// Select the next item of the currently selected item 
// in the combo box.
int nIndex = pmyComboBox->GetCurSel();
int nCount = pmyComboBox->GetCount();
if ((nIndex != LB_ERR) && (nCount > 1))
{
   if (++nIndex < nCount)
      pmyComboBox->SetCurSel(nIndex);
   else
      pmyComboBox->SetCurSel(0);
}

CComboBox OverviewClass MembersHierarchy Chart

See Also   CComboBox::SetCurSel, CB_GETCURSEL