Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

CListBox::DeleteString 

Deletes the item in position nIndex from the list box.


int DeleteString(
   UINT nIndex 
);

Parameters

nIndex

Specifies the zero-based index of the string to be deleted.

A count of the strings remaining in the list. The return value is LB_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 list 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.

// The pointer to my list box.
extern CListBox* pmyListBox;

// Delete every other item from the list box.
for (int i=0;i < pmyListBox->GetCount();i++)
{
   pmyListBox->DeleteString( i );
}

Community Additions

ADD
Show:
© 2015 Microsoft