List Box - Shortcutmenu disable (1 Viewer)

GUIDO22

Registered User.
Local time
Today, 00:35
Joined
Nov 2, 2003
Messages
515
I have successfully used a list box in a form inrcorporating a right mouse click event in the list box itself, to toggle the selection of all list items..
The list box is 'Extended' type.

Using a similar setup on another form I am writing - when I right click, although the code to Toggle the 'selected' state of the listitems runs fine... the default Windows Shortcut menu (Cut/Copy/Paste...), is displaying at the mouse pointer. But, it doesnt do this on the earlier form I created. Having been through the list items properties i cannot see a setting to prevent the display of the shortcut menu from previous.
So I am assuming something in the VBA code I am running on the earlier form is preventing the display of this shortcut menu.

Is there some other means to override the default display action of this shortcut when right clicking in the list box?

Thanks in advance
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:35
Joined
May 7, 2009
Messages
19,237
you add code to the MouseUp event of your listbox to select all items on the list:
Code:
Private Sub List0_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Integer
If Button = 2 Then
    DoCmd.CancelEvent
    With Me!yourListboxNameHere
        For i = 0 To .ListCount - 1
            .Selected(i) = True
        Next i
    End With
End If

End Sub
 

Users who are viewing this thread

Top Bottom