Tuesday 15 December 2015

[Solved] Hide taskbar icon when windows Application exit in C#

By using this small piece of code in c# you will able to hide notify icon of any windows application from taskbar.

Once i was working with windows application in c# i made a small application which was running in background. Windows form was hidden but notify icon was showing in taskbar. I was trying to close application by using  Application.Exit(); but still notifyicon was showing in taskbar.
Then i used given line of code, that worked for me :)

notifyIcon1.Dispose();
Application.Exit();
Environment.Exit(-1);