• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 470
  • Last Modified:

How to catch right click on notify icon event?

How do I  catch a  right click on notify icon event?
0
netslt
Asked:
netslt
  • 2
1 Solution
 
coletteck8Commented:
the Mouse_Down event catch all clicks and using the Button parameter you can check either left or right click.
0
 
netsltAuthor Commented:
Sorry but can you please be more precise and give me a sample?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
The two subs below will detect a right click.  The first on a Right Click Down and the second on a Right Click Up:

    Private Sub NotifyIcon1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDown
        If e.Button = MouseButtons.Right Then
            MsgBox("Please don't do that...", MsgBoxStyle.Information, "Right Click Down")
        End If
    End Sub

    Private Sub NotifyIcon1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseUp
        If e.Button = MouseButtons.Right Then
            MsgBox("Please don't do that...", MsgBoxStyle.Information, "Right Click Up")
        End If
    End Sub
0
 
netsltAuthor Commented:
Works - thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now