how to stop selection from a listbox
how do I disable the selection of an item in a listbox?
For example I already selected item1 from the listbox, I cannot select that same item1 again. How do i do that?
Lightning03
Junior Poster in Training
92 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
Not quite sure what you mean by ".. already selected... cannot select that item again".
Two ideas that might help you achieve what you want.
1. Remove the item once selected - (perhaps moving it to another listbox).
2. Set SelectionMode to MultiSimple - that way once it is selected it stays selected until clicked again.
nick.crane
Nearly a Posting Virtuoso
1,230 posts since Feb 2010
Reputation Points: 375
Solved Threads: 187
You have to be more specific as to what are you hoping to archive.
1. as Nick has said, you have an option of removing it from the list (if you don't want it to be selected twice), but what difference will it make if it's selected twice as the index will be the same, unless you have multiple items which are the same.
2. immediately after a selection has been made, disable the listbox until some condition has been met. lstbox.Enable=false; which you'll still have access to it programmatically
mshauny
Junior Poster in Training
62 posts since Jan 2010
Reputation Points: 35
Solved Threads: 6