Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Loop through all selected items in a listbox
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00311890
Message ID:
00311946
Views:
31
Hi Fred,
>>
>>Sorry for this simple question, but how can I operate with selected item values in a multiselected listbox? Say, I want to remove each selected item (several in one time) from the list, how can I do it?
>
>Since the ListBoxes Selected property is like an array, you could traverse it starting from the end back towards the beginning so as not to disturb the order while you're deleting entries:
>
>FOR x=oListBox.ListCount TO 1 STEP -1
> remove your entry
>ENDFOR

I put this code in list.RightClick() event and when spent almost 1 hour trying to understand, why it doesn't work. Finally I discovered, that RightClick() loose the current selection and keeps only one item selected. Is there a way to avoid this behavior or RightClick is a bad place to put such code?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform