Jump to content
Sign in to follow this  
gcue

delete items from listview

Recommended Posts

gcue

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

Share this post


Link to post
Share on other sites
PowerCat

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

Share this post


Link to post
Share on other sites
hannes08

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]

Share this post


Link to post
Share on other sites
gcue

awesome =)

thanks fellas.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.