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

Recommended Answers

All 2 Replies

See if this helps.
1 NotifyIcon, 1 ContextMenuStrip

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        NotifyIcon1.ContextMenuStrip = ContextMenuStrip1 '// attach ContextMenu to NotifyIcon.
    End Sub

    Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
        If e.Button = MouseButtons.Right Then NotifyIcon1.ContextMenuStrip.Show() '// Show ContextMenu on Right Mouse click.
    End Sub
End Class

Thanks man, that helped alot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.