Notify Icon

Posted by in C# category on for Beginner level | Views : 11479 red flag
Rating: 5 out of 5  
 1 vote(s)

This article will explore the details of the Notify Icons

 Download source code for Notify Icon


This article will explore the Notify Icon creation. Sometime we require Icon in system which is used to manage the application. This article will explore the details related to the Notify Icon.

Images that the Application Look Like

Create Project

Please create new project with Windows application template having the language C# or VB. I have created using C#

Add Controls to the Form
Add the following controls in the Form
1. Notify Icon: This control is used to display the icon in the taskbar.
2. Context Menu Strip: This control is used to add the right click menu to the Icon in the taskbar.
3. Button: This control is used to fire event to hide the form and display the Notify Icon in the Taskbar.

Set Control's Properties

Properties to be set for the controls

  1. Form
    1. Title bar of the Form (Text)
  2. Notify Icon
    1. Name of the control (Name)
    2. Icon to be display in the taskbar (Icon)
    3. Context menu list (ContextMenuStrip)
  3. ContextMenuStrip
    1. List of the Menu for Right click (Items)
  4. Button:
    1. Set the name to identify (Name)
    2. Text to display (Text)

Set the Event for the Controls

Set the events for the controls

  1. Button:
    1. Click event: This event hides the form and makes the notify icon visible true with balloon tip.
  2. ContextMenuStrip:
    1. ItemClicked: This event is used to fire the event for the click of the context menu at icon’s right click.

Event fire or execution

Button  è Click:

Step 1: Hide the form

Step 2: Make the Notify Icon visible true

Step 3: Set the Mouse hover or tool tip text (Text) property for Notify Icon

Step 4: Display Balloon Tip

Step 5: Set the context menu property for Notify Icon that we have created earlier.

ContextMenuStrip è ItemClicked

Step 1: Check the Item text to know which item is clicked

Step 2: Make the Effect according to it

a.       If we have selected the “Show Me”, make the form visible and hide the icon

b.      If we have selected the “Show Date Time”, display the Balloon Tip with date time

c.       If we have selected Exit, Exit from the system



using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;


namespace NotifyIconExample


    public partial class NotifyIconExample : Form


        public NotifyIconExample()





        private void button1_Click(object sender, EventArgs e)



            notifyIcon1.Visible = true;

            notifyIcon1.Text = "Notify Icon Example";

            notifyIcon1.ShowBalloonTip(300, "Notify Icon", "Form Hidden", ToolTipIcon.Info);

            notifyIcon1.ContextMenuStrip = contextMenuStrip1;



        private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)



            if (e.ClickedItem.Text == "Show Me")



                notifyIcon1.Visible = false;


            else if (e.ClickedItem.Text == "Show Date Time")


                notifyIcon1.ShowBalloonTip(300, e.ClickedItem.Text, "Date Time: " + DateTime.Now.ToString(), ToolTipIcon.Info);


            else if (e.ClickedItem.Text == "Exit")


                if (MessageBox.Show("Are you sure you want to exit?", "Warning", MessageBoxButtons.OKCancel) == DialogResult.OK)








(This code is converted from C# to


Imports System

Imports System.Collections.Generic

Imports System.ComponentModel

Imports System.Data

Imports System.Drawing

Imports System.Text

Imports System.Windows.Forms


Namespace NotifyIconExample

    Partial Public Class NotifyIconExample

        Inherits Form

        Public Sub New()


        End Sub


        Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)


            notifyIcon1.Visible = True

            notifyIcon1.Text = "Notify Icon Example"

            notifyIcon1.ShowBalloonTip(300, "Notify Icon", "Form Hidden", ToolTipIcon.Info)

            notifyIcon1.ContextMenuStrip = contextMenuStrip1

        End Sub


        Private Sub contextMenuStrip1_ItemClicked(ByVal sender As Object, ByVal e As ToolStripItemClickedEventArgs)


            If e.ClickedItem.Text = "Show Me" Then


                notifyIcon1.Visible = False

            ElseIf e.ClickedItem.Text = "Show Date Time" Then

                notifyIcon1.ShowBalloonTip(300, e.ClickedItem.Text, "Date Time: " + DateTime.Now.ToString(), ToolTipIcon.Info)

            ElseIf e.ClickedItem.Text = "Exit" Then

                If MessageBox.Show("Are you sure you want to exit?", "Warning", MessageBoxButtons.OKCancel) = DialogResult.OK Then


                End If

            End If

        End Sub

    End Class

End Namespace

Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: nikhil chauhan
Member Level: Bronze
Member Status: Member
Member Since: 11/25/2008 9:12:37 PM
Keep posting and Enjoy coding...

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)