where is your add handler at? in the load? does it depend on another event
happening first? compare it to the sample code from MSDN
' Initalize the NofifyIcon object's shortcut menu.
Private Sub InitializeContextMenu()
Dim menuList() As MenuItem = New MenuItem() _
{New MenuItem("Sign In"), New MenuItem("Get Help"), _
New MenuItem("Open")}
Dim clickMenu As New ContextMenu(menuList)
NotifyIcon1.ContextMenu = clickMenu
End Sub
' When user clicks the left mouse button display the shortcut menu.
' Use the SystemInformation.PrimaryMonitorMaximizedWindowSiz e property
' to place the menu at the lower corner of the screen.
Private Sub NotifyIcon1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles NotifyIcon1.Click
Dim windowSize As System.Drawing.Size = _
SystemInformation.PrimaryMonitorMaximizedWindowSiz e
Dim menuPoint As System.Drawing.Point = New System.Drawing.Point _
(windowSize.Width - 180, windowSize.Height - 5)
menuPoint = Me.PointToClient(menuPoint)
NotifyIcon1.ContextMenu.Show(Me, menuPoint)
End Sub
<no****@meatonconsulting.comwrote in message
news:11*********************@q40g2000cwq.googlegro ups.com...
>I am using VB Net 2005 and want to use the notifyicon. I do not have a
form, only a class. I have no problems showing or modifying the
NotifyIcon, however, I am having a problem handling the click event. I
have tried unsuccessfully using AddHandler:
AddHandler nIcon.Click AddressOf nIcon_Click
Private Sub nIcon_Click(ByVal sender As Object, ByVal e As EventArgs)
MsgBox("Click")
End Sub
Any help would be greatly appreciated.