CComboBox::DeleteString

从组合框中删除在位置 nIndex 的项目。

int DeleteString(
   UINT nIndex 
);

参数

  • nIndex
    指定索引到要删除的字符串。

返回值

如果返回值大于或等于0,则它是保持在列表的字符串的计数。 返回值是 CB_ERR,如果 nIndex 比项的数目指定大索引列表中的。

备注

按照 nIndex 的所有项目现在向下移动一个位置。 例如,因此,如果组合框包含两个项目,删除的第一项会导致剩余的项目现在第一个位置。 项目的nIndex=0在第一个位置。

示例

// Delete every item from the combo box.
for (int i = m_pComboBox->GetCount() - 1; i >= 0; i--)
{
   m_pComboBox->DeleteString(i);
}

要求

Header: afxwin.h

请参见

参考

CComboBox选件类

层次结构图

CComboBox::InsertString

CComboBox::AddString

CB_DELETESTRING