Select Items In ListBox With Right Mouse Button

'Add 1 List Box to your form. Add few items to the List Box list.
'Insert this code to your form:

Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim iTemp As Integer
If Button = vbRightButton Then
With List1
iTemp = ((Y / Screen.TwipsPerPixelY) \ (TextHeight("A") / Screen.TwipsPerPixelY)) _
+ .TopIndex
If iTemp > .ListCount - 1 Then iTemp = -1
.ListIndex = iTemp
End With
End If
End Sub

Go Back