I have a notify icon in the system tray for my application. When I right click the icon, a menu pops up with 3 items to pick. Here's where I'm stuck - how do I make my program do something when I pick one of the 3 items on the menu? ie. what is the event to catch the click on a context menu? Here is my code so far:
Thanks for any help...
Visual Basic:
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Initalize the NotifyIcon object's shortcut menu.
Dim menuList() As MenuItem = New MenuItem() {New MenuItem("Menu 1"), New MenuItem("Menu 2"), New MenuItem("Exit")}
Dim clickMenu As New ContextMenu(menuList)
NotifyIcon1.ContextMenu = clickMenu
End Sub
Private Sub TrayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrayButton.Click
NotifyIcon1.Icon = System.Drawing.SystemIcons.Information
NotifyIcon1.Text = "Tray Test"
NotifyIcon1.Visible = True
Me.Hide()
End Sub
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
NotifyIcon1.Visible = False
Me.Show()
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
NotifyIcon1.Visible = False
Me.Close()
End Sub
End Class
Thanks for any help...