gcue Posted May 5, 2011 Share Posted May 5, 2011 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 More sharing options...
PowerCat Posted May 5, 2011 Share Posted May 5, 2011 (edited) 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 May 5, 2011 by PowerCat Link to comment Share on other sites More sharing options...
hannes08 Posted May 5, 2011 Share Posted May 5, 2011 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. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
gcue Posted May 5, 2011 Author Share Posted May 5, 2011 awesome =) thanks fellas. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now