Multi-select listbox - mousedown event

G

Greg Lovern

With a multi-select listbox, when the mousedown event fires when a
user clicks one of the boxes, the Selected property reports the
selection state of the list BEFORE the mouseclick. Since I don't know
what box was clicked, I don't know the selection state of any list
items when that event fires; all I know is that the selection state
one of the list items is different than reported by the Selected
property.

The Enter event also fires if the listbox didn't already have focus,
but it has the same problem.

No other events fire when the user clicks one of the boxes, as far as
I can tell.

Is there any way to get the true selection state of the list when the
user clicks one of the boxes in the list?


Thanks,

Greg
 
G

GS

After serious thinking Greg Lovern wrote :
With a multi-select listbox, when the mousedown event fires when a
user clicks one of the boxes, the Selected property reports the
selection state of the list BEFORE the mouseclick. Since I don't know
what box was clicked, I don't know the selection state of any list
items when that event fires; all I know is that the selection state
one of the list items is different than reported by the Selected
property.

The Enter event also fires if the listbox didn't already have focus,
but it has the same problem.

No other events fire when the user clicks one of the boxes, as far as
I can tell.

Is there any way to get the true selection state of the list when the
user clicks one of the boxes in the list?


Thanks,

Greg

Try this...

Private Sub ListBox1_Change()
Debug.Print ListBox1.ListIndex
End Sub
 

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