Multi-Select listbox selection order

T

TonyT

Hi,

I'm using a multiSelect listbox, but need to know the order that the items
were selected. Is there a way to do this without *lots* of coding after each
item has been selected (I know I'll need some coding to de-select the whole
list if the primary selection is de-selected) ie. can the ItemsSelected
property be ordered in such a way?
 
S

Stuart McCall

TonyT said:
Hi,

I'm using a multiSelect listbox, but need to know the order that the items
were selected. Is there a way to do this without *lots* of coding after
each
item has been selected (I know I'll need some coding to de-select the
whole
list if the primary selection is de-selected) ie. can the ItemsSelected
property be ordered in such a way?

No the ItemsSelected collection is read-only. You can, however, maintain
your own collection, by adding to it in the OnClick event:

With Me.ListboxName
If .Selected(.ListIndex) Then
MyCollection.Add .ListIndex
End If
End With

Then you can read them out of MyCollection, in clicked on order. To clear
MyCollection, just do:

Set MyCollection = New Collection
 
T

TonyT

Thanks Stuart,

Now why didn't I think of that? As usual overlooking the obvious in search
of complication....<g>

TonyT..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top