How can i detect mouse button clicked?
does i have to use api function?

Recommended Answers

All 5 Replies

any help??

this will detect if mouse button clicked :

Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
        If e.Button = MouseButtons.Left Then
            MsgBox("left button clicked")
        ElseIf e.Button = MouseButtons.Right Then
            MsgBox("Right button clicked")
        End If
    End Sub
commented: thx..i didn't know how easy it is +1

Ok..Thats worked.
i convert it into select-case.
thanks for direction :)

this is my convert code :

Select Case e.Button
            Case MouseButtons.Left
                MsgBox("left button clicked")
            Case MouseButtons.Middle
                MsgBox("Right button clicked")
            Case MouseButtons.Right
                MsgBox("Middle button clicked")
        End Select
commented: nice converting +9

Nice converting friend...
>>thanks for direction
Any time :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.