How do you delete a selected list item?
Printable View
How do you delete a selected list item?
If we're talking about a CListCtrl, then the following will do it:
POSITION pos;
int iCount;
pos = m_ListCtrl.GetFirstSelectedItemPosition();
while (pos)
{
iCount = m_ListCtrl.GetNextSelectedItem(pos);
m_ListCtrl.DeleteItem(iCount);
}
Just remember that if you are doing a multiple delete, then you should delete in reverse order since the index numbers change after every delete.
Eddie