Udostępnij za pośrednictwem


CComboBox::GetCurSel

Call this member function to determine which item in the combo box is selected.

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

GetCurSel returns an index into the list.

Example

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

Requirements

Header: afxwin.h

See Also

Reference

CComboBox Class

Hierarchy Chart

CComboBox::SetCurSel

CB_GETCURSEL

Other Resources

CComboBox Members