Extended Multi Select List Box and Keyboard navigation

  • Thread starter Thread starter Hakan Naslund
  • Start date Start date
H

Hakan Naslund

Hi!

I have a listbox configured as Extended Multi Select.

On the After Update Event, I have this code:
Private Sub List0_AfterUpdate()
For Each itm In List0.ItemsSelected
Debug.Print List0.ItemData(itm)
Next itm
End Sub

If I use the mouse to select records (just single records, no ctrl or
shift!), the
debug.print return the correct row and data.

BUT if I use the keyboard arrow keys to move up/down in the listbox,
the debug.print will show the values of the row that was active before the
up/down move!

Let's say my list box shows the following rows:
Andrew
Burt
Charlie
Derek

A mouseclick on Burt will debug.print '1 Burt'
A mouseclick on Charlie will debug.print '2 Charlie'

If I now use the keyboard's down key to move to Derek, it will still print
'2 Charlie' !
And if I press the up key and move back to Charlie, it prints '3 Derek'.

So when using the keyboard I'm always one step behind what's actually
marked...

Any ideas?

Hakan Naslund
Sweden
 
Back
Top