Link to home
Start Free TrialLog in
Avatar of StewSupport
StewSupport

asked on

open menu when right click on notifyicon vb.net

how do i open a menu to exit the application when i right click on notifyicon in the systemtray? thanks.
Avatar of wellhole
wellhole

Add a contextmenu to the click handler for the icon.
Avatar of StewSupport

ASKER

how do i add the context menu to the icon?
   Private Sub Icon_MouseUp(ByVal sender As Object, ByVal e As EventArgs) Handles icon.MouseUp
        icon.ContextMenu = New ContextMenu
        icon.ContextMenu.MenuItems.Add("Close", AddressOf YourExitHandler)
    End Sub
YourExitHandler not sure what this will be please help

Private Sub YourExitHandler(ByVal sender As Object, ByVal e As EventArgs)
  Application.Exit()
End Sub
that doesn't pop up any menu.
ASKER CERTIFIED SOLUTION
Avatar of wellhole
wellhole

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oh no i meant to give wellhole the point.
i sent email to ask if i can reassign point but in case if they don't answer, can i just create new question and just give you the point? thanks.