CListBox::GetCount

更新 : 2007 年 11 月

リスト ボックスの項目数を取得します。

int GetCount( ) const;

戻り値

リスト ボックス内の項目数を返します。エラーが発生した場合は LB_ERR を返します。

解説

最終項目のインデックス値よりも 1 大きい数値を返します (インデックスは 0 から始まります)。

使用例

// 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

参照

参照

CListBox クラス

階層図

LB_GETCOUNT

その他の技術情報

CListBox のメンバ