Ok full code enclosed (Not sure where you'll try to run it from but I'm in N drive so it might emo, but you can view form1.vb as it's all in there anyway even if project wont run)
WindowsApplication2.zip
(From Scratch)
Step 1:
Add ContextMenu and NotifyIcon from Toolbox (I left as default names)
Step 2:
In form load, Link Notifyicon to the menu (so when you right click it it appears near etc)
Step 3:Code:Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load NotifyIcon1.ContextMenuStrip = ContextMenuStrip1 'Links menu to the Icon (aka, why yours was miles away) End Sub
Link event of clicking Icon to menu showing
Step 4:Code: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() 'Shows menu when Icon right clicked End Sub
Add menu items (Click on contextmenu item on form design page), Right click and edit items (add menu items)
Step 5:
Link commands/subs to clicks
Code:Private Sub InfoMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InfoMenu.Click MsgBox("You clicked Info") 'When Info clicked End Sub
If the default project works ignore my waffleBut I know when I tried it at home, it emo'd as my home pc is C:\ (obviously) and work one is N:\ :P
Any problems shout etc,
(ps, off topic but anyone knows how to disable quotes popping up as huge AMG ALERTS on edugeek?)
Steve



LinkBack URL
About LinkBacks
But I know when I tried it at home, it emo'd as my home pc is C:\ (obviously) and work one is N:\ :P
Reply With Quote



