Last list item selected in a Multi-Select list box?
I am not aware of any way to do this. A listbox does not have any property
to tell you the chronological order of selection of items - and it may not
even store the order (all it cares about is the final list of items
selected). I don't even think you could capture it with any events, since I
don't think any events fire until the selections are made (but I may be
wrong... anyone?).
If the order of selection is important to you, you may have to design your
own control to capture this - probably would need to combine some existing
controls with custom code.
--
- K Dales
"Brian" wrote:
I posted this late Friday with no good responses.
I'm trying to figure out which item in a multi select list box was last
selected. Not the last item in the list, but the last item selected.
For example... A list box with three items "List 1", "List 2", and "List
3". The user could select "List 3" and then "List 1". I would like the
algorithm to tell me that on the second Listbox change event... that "List
1" was selected.
Then on the flip side.... the logic would have to know whether an item was
deselected as well.
I played around with using a couple of collection objects... but couldn't
come up with a good way to compare the two collections to find the
difference... which would in theory tell me what object had changed in the
listbox.
Any thoughts?
Thanks,
Brian
|