VB - Notify Icon

Webnode

Hello, in this tutorial I'll teach you how to use the notifyIcon component in visual basic 2008/2010.

Start by opening/creating a project.
Double-click the notifyIcon component in the toolbox:

 

The new component should now appear underneath your form;

Set the text of NotifyIcon1 to 'Tutorial !!' . You could also use the title of your program.

Add a contextmenu to your form. This will be used as a menu when you right-click the notifyIcon.
Then add something like 'Close' to the contextmenustrip.

Then select the notifyIcon and set the propertie ContextMenuStrip to ContextMenuStrip1:

You will now need an icon for your notifyIcon. If you don't have an icon, you can download some here:
http://www.iconarchive.com/

Click the Icon property of your NotifyIcon and browse for the icon you selected.

 

Then press F5. You are now able to see the icon of your program in the right corner of your taskbar !

When you right-click this icon, the contextmenu will appear. You could add several functions to the contextmenu.
For this tutorial, it will only show 'Close' and it won't do anything. To make it close your form, in visual studio, click
the contextmenustrip1 and double click the close button:

 

Add the following codes:

Application.Exit()

Download the source codes:
NotifyIcon.rar (248,6 kB)


Topic: VB - Notify Icon

No comments found.