Jump to content

delete items from listview


Recommended Posts

i am trying to cycle through a listview and see which items are checked for deletion

problem is, the item's index number changes so $x wouldnt be the same index number..

$startmenu_entries_count = _GUICtrlListView_GetItemCount($startmenu_entries_listview)

    For $x = 0 To $startmenu_entries_count
        $checked = _GUICtrlListView_GetItemChecked($startmenu_entries_listview, $x)

        If $checked = True Then
            _GUICtrlListView_DeleteItem($startmenu_entries_listview, $x)            
        EndIf
    Next
Link to comment
Share on other sites

From my experience and messages from this board, deleting items from arrays while looping should be done backwards:

$startmenu_entries_count = _GUICtrlListView_GetItemCount($startmenu_entries_listview)

    For $x = $startmenu_entries_count to 0 step -1
        $checked = _GUICtrlListView_GetItemChecked($startmenu_entries_listview, $x)
        If $checked = True Then
            _GUICtrlListView_DeleteItem($startmenu_entries_listview, $x)            
        EndIf
    Next
Edited by PowerCat
Link to comment
Share on other sites

From my experience and messages from this board, deleting items from arrays while looping should be done backwards:

...

Well, that would have been my advice, too. :unsure:

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...