CListBox::GetCount
リスト ボックスの項目数を取得します。
int GetCount( ) const;
戻り値
エラーが発生した場合、リスト ボックスの項目の数、つまり LB_ERR。
解説
返された計算は最後の項目のインデックス値よりも 1 大きい数値になります (インデックスの値は)。
使用例
// 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);
必要条件
ヘッダー: afxwin.h