listbox double click which item

  • Thread starter Thread starter mp
  • Start date Start date
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
 
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.
 
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 :-)
 
Back
Top