CComboBox::GetCount

更新 : 2007 年 11 月

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

int GetCount( ) const;

戻り値

項目数を返します。最終項目のインデックス値よりも 1 大きい数値を返します (インデックスは 0 から始まります)。エラーが発生した場合は、CB_ERR を返します。

使用例

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

必要条件

ヘッダー : afxwin.h

参照

参照

CComboBox クラス

階層図

CB_GETCOUNT

その他の技術情報

CComboBox のメンバ