MouseUp Event

This event occurs when the user releases a mouse button over the system tray icon.

Syntax

Private Sub csSysTray_MouseUp(button As Integer)
Private Sub csSysTray_MouseUp([index As Integer,]button As Integer)

The MouseUp event syntax has these parts:

Part Description
csSysTray The SysTray control you are working with.
index An integer that uniquely identifies a control if it's in a control array.
button Returns an integer that identifies the button that was released to cause the event. The button argument is a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Buttons are OR'd together to indicate which button(s) caused the event.

Quick Tip

The numbers that represent the button values (1, 2, and 4) are built-in Visual Basic constants.  You can use vbLeftButton instead of 1, vbRightButton instead of 2, and vbMiddleButton instead of 4.

Examples

Example 1 (Responding to a MouseUp event with a message for each button released)

Private Sub csSysTray1_MouseUp (Button As Integer)

If (Button And vbLeftButton) Then 'vbLeftButton = 1
MsgBox "Left Button Released"
End If
If (Button And vbRightButton) Then 'vbRightButton = 2
MsgBox "Right Button Released"
End If
If (Button And vbMiddleButton) Then 'vbMiddleButton = 4
MsgBox "Middle Button Released"
End If

End Sub