Condividi tramite


CComboBox::GetCount

Call this member function to retrieve the number of items in the list-box portion of a combo box.

int GetCount( ) const;

Return Value

The number of items. The returned count is one greater than the index value of the last item (the index is zero-based). It is CB_ERR if an error occurs.

Example

// Add 10 items to the combo box.
CString strItem;
for (int i = 0; i < 10; i++)
{
   strItem.Format(_T("item %d"), i);
   m_pComboBox->AddString(strItem);
}

// Verify the 10 items were added to the combo box.
ASSERT(m_pComboBox->GetCount() == 10);

Requirements

Header: afxwin.h

See Also

Reference

CComboBox Class

Hierarchy Chart

CB_GETCOUNT

Other Resources

CComboBox Members