I am trying to show a context menu when i click on the tray icon (mnuLeft for left click and mnuRight for right click)
Private Sub NotifyIcon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrayIcon.Click
If e.Equals(MouseButtons.Left) Then
TrayIcon.ContextMenuStrip = mnuLeft
ElseIf e.Equals(MouseButtons.Right) Then
TrayIcon.ContextMenuStrip = mnuRight
End If
TrayIcon.ContextMenuStrip.Show(Control.MousePosition) 'or ContextMenuStrip.Show(Control.MousePosition)
End Sub
and I get the following error (on the ContextMenuStrip.Show line): NullReferenceException was unhandled
Can anyone help me out, any alternatives are welcomed...
PS:
.Show(Cursor.Position) >> same error
e.location >> Error 1 'location' is not a member of 'System.EventArgs'