CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    deleting list items

    How do you delete a selected list item?


  2. #2
    Join Date
    Apr 1999
    Posts
    4

    Re: deleting list items

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured