CListBox::GetCount

intGetCount()const;

Return Value

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

Remarks

Retrieves the number of items in a list box.

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

Example

// The pointer to my list box.
extern CListBox* pmyListBox;

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

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

CListBox OverviewClass MembersHierarchy Chart

See Also