Поделиться через


CComboBox::DeleteString

Deletes the item in position nIndex from the combo box.

int DeleteString(
   UINT nIndex 
);

Параметры

  • nIndex
    Specifies the index to the string that is to be deleted.

Возвращаемое значение

If the return value is greater than or equal to 0, then it is a count of the strings remaining in the list. The return value is CB_ERR if nIndex specifies an index greater than the number of items in the list.

Заметки

All items following nIndex now move down one position. For example, if a combo box contains two items, deleting the first item will cause the remaining item to now be in the first position. nIndex=0 for the item in the first position.

Пример

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

CComboBox Members

Hierarchy Chart

CComboBox::InsertString

CComboBox::AddString

CB_DELETESTRING