Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

How to use Notify Icon Control in VB and C# (.net 2.0).

Author: Zunnair
Download Source Code : 886_window control.zip

In this simple article you will learn that how we can make a notify icon for our application in VB and C# .net 2.0.

 

What is Notify Icon?
Notify icon is an icon which is shown in system tray when the application runs. This icon remains in the tray till the application runs.
To make notify icon for our application dot net provides us a built in control named notify icon. This displays the icon in the notification area or tray on run time.
Properties:
There are some properties of notify icon control which should be set to make icon for our application. These properties can also be set dynamically. Some important properties are shown bellow.
Balloon Tip Icon:
When the application runs we can show a balloon to provide some information about our application. Balloon tip icon property tells that what type of balloon should be shown for our application. There are three type’s information, warning and error. You can set this property dynamically.
To demonstrate make a window application. Drag notify icon.
Now write the following code on FORM LOAD event:
 C#
private void Form1_Load(object sender, EventArgs e)
        {
            this.Text = "DEVASP NOTIFYICON APPLICATION";
            notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
        }
VB
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Me.Text = "DEVASP NOTIFYICON APPLICATION"
        notifyIcon1.BalloonTipIcon = ToolTipIcon.Info
    End Sub
This simple code sets the balloon tip icon property. Tool Tip Icon is an enumeration provided by dot net to select the balloon type.
Balloon Tip Text:
This property is used to write the text which should be shown to user or which should be written on balloon when it is shown to user.
Now write the following code on FORM LOAD event:
 C#
private void Form1_Load(object sender, EventArgs e)
        {
            this.Text = "DEVASP NOTIFYICON APPLICATION";
            notifyIcon1.BalloonTipText = "THIS IS DEVASP APPLICATION";
       }
VB
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Me.Text = "DEVASP NOTIFYICON APPLICATION"
        notifyIcon1.BalloonTipText = "THIS IS DEVASP APPLICATION"
    End Sub
This simple code will set the text which should be written on balloon.
Balloon Tip Title:
This property is used to set the title of balloon which you want to show the user.
Now write the following code on FORM LOAD event:
C#
private void Form1_Load(object sender, EventArgs e)
        {
            this.Text = "DEVASP NOTIFYICON APPLICATION";
            notifyIcon1.BalloonTipTitle = "DEVASP.NET";
        }      
VB
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Me.Text = "DEVASP NOTIFYICON APPLICATION"
        notifyIcon1.BalloonTipTitle = "DEVASP.NET"
    End Sub
This is the simple code to set the title of balloon.
Icon:
Icon property is used to select icon which should be shown in tray when application runs. Go in property window and select the icon by the path browser.
Visible:
This property is used to set that the balloon and icon should be shown or not.
Now write the following code on FORM LOAD event:
C#
private void Form1_Load(object sender, EventArgs e)
        {
            this.Text = "DEVASP NOTIFYICON APPLICATION";
            notifyIcon1.Visible = true;
        }     
VB
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Me.Text = "DEVASP NOTIFYICON APPLICATION"
        notifyIcon1.Visible = True
    End Sub
This simple code sets that balloon should be shown to user or not.
Show Balloon Tip Function:
This is a function which is used to show the balloon for a specific time. This function takes an integer as time interval for which balloon should be shown. Time is in millisecond.
To demonstrate, drag one button and press the button.
Now write the following code on Button click event:
C#
private void button1_Click(object sender, EventArgs e)
        {
            notifyIcon1.ShowBalloonTip(1000);
        }    
VB
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
        notifyIcon1.ShowBalloonTip(1000)
    End Sub
 
This simple article tells that how we can make notify icon for our application in VB and C# .net 2.0.

 

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to do Sorting using Quick Sort algorithm in C# (.net 2.0)

Disclaimer - Privacy
© 2002-2017 DevASP.net