Export (0) Print
Expand All

CListBox::GetCount

Retrieves the number of items in a list box.

int GetCount( ) const;

The number of items in the list box, or LB_ERR if an error occurs.

The returned count is one greater than the index value of the last item (the index is zero-based).


// Add 10 items to the list box.
CString str;
for (int i = 0; i < 10; i++)
{
   str.Format(_T("item %d"), i);
   m_myListBox.AddString(str);
}

// Verify that 10 items were added to the list box.
ASSERT(m_myListBox.GetCount() == 10);


Header: afxwin.h

Community Additions

ADD
Show:
© 2015 Microsoft