NotifyIcon and ContextMenuStrip

V

Viper

I added a NotifyIcon to my project and a ContextMenuStrip so that when
the taskbar icon is clicked a menu shows up. I added the
ContextMenuStrip to the properties menu for the notifyicon. now when
i run the program when i right-click the notifyicon the first time
nothing happens, but the menu shows up the second time i click it. it
only seems to display the menu every-other click. makes no sense to
me.

I have no idea why, any help would be greatly appreciated.
 
C

Crimson L. Espada

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 <strong class="highlight">NotifyIcon</strong>.
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 <strong class="highlight">click</strong>.
End Sub
End Class


Source: http://www.daniweb.com/forums/post1477935.html#post1477935
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top