Поделиться через


CComboBox::GetCurSel

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

int GetCurSel( ) const;

Возвращаемое значение

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.

Заметки

GetCurSel returns an index into the list.

Пример

// 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);
}

Требования

Header: afxwin.h

См. также

Основные понятия

CComboBox Class

CComboBox Members

Hierarchy Chart

CComboBox::SetCurSel

CB_GETCURSEL