listbox double click which item

M

mp

I want to know which item in a listbox was double clicked on.
This works but doesn't seem like i should have to do it this way

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim index As Integer

With ListBox1
For index = 0 To .ListCount - 1
If .Selected(index) Then
MsgBox index
End If
Next
End With

End Sub

thanks for any tips
mark
 
C

CellShocked

I want to know which item in a listbox was double clicked on.
This works but doesn't seem like i should have to do it this way

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim index As Integer

With ListBox1
For index = 0 To .ListCount - 1
If .Selected(index) Then
MsgBox index
End If
Next
End With

End Sub

thanks for any tips
mark

Listboxes are SINGLE click to SELECT. Unles you put up a hard picker
menu and assign hyperlinks or the like to each cell. Even then, it is
SINGLE click.
 
M

mp

CellShocked said:
Listboxes are SINGLE click to SELECT. Unles you put up a hard picker
menu and assign hyperlinks or the like to each cell. Even then, it is
SINGLE click.

Thanks for your response. I'm not sure what your point is though.
I know I can select an item with a single click. I was just looking for
how to get at the item on which the user double clicks
(which also selects that item - as well as raising the dblclick event)
as Jim pointed out it was ListIndex i was forgetting.
Thanks
Mark
ps...cute nyme :)
 

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