Sunday, August 21, 2011

.Net Interview Question:- How to add your window application icon to the task bar?

This is not one of the .NET typical interview question but as a developer you would be interested in knowing that how to add your windows application icon in to the task bar.
Let’s demonstrate a simple example to see how exactly you can add your windows
application icon in the task bar.

In order to achieve the above subject just follow the following steps.

Step1: - create a windows application for that Go To > File >
> Project > Windows > Select Windows Forms Application.

Step2: - Now from the toolbox just add the “NotifyIcon” control to the main

Step3: - Go to the properties of the NotifyIcon control and set the properties
like below diagram.

In the above diagram you can see that I have set the following properties.

BalloonTipIcon = Warning.

BalloonTipText = Click to enlarge.

BalloonTipTitle = Message.

: - please select an icon with .ico extension with maximum size of48 * 48.
Step4: - Add a Button on the form and add the below code snippet in to

private void button1_Click(object sender, EventArgs e)



this.Visible = false;


Once you have completed with all the above steps now just run your
application and will see that the selected application icon is now being added
to the task bar to the right bottom of your screen like below diagram.

In above diagram you can clearly see that now the application icon is being
added to the task bar.
Now, when you click on the Button1 you will see a message pops up like below diagram as we have declared to the properties of the NotifyIcon control.

Also view our video of C# interview questions on Garbage Collector as follows: -

Visit us for more tutorials on Most asked Dotnet interview questions

Get more .Net / C# interview questions from author’s blog

No comments: