Mar 16, 2008

5 minutes C# to dispose your NotifyIcon object

If you have this problem - try calling .Dispose() method for your NotifyIcon explicitly in the FormClosing event:


    
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
     {
        notifyIcon1.Dispose();
     }

Note : this trick may not work if the Application was terminated abnormally. I will investigate that issue when I have some free time and report back what is the best approach on this.
>

1 comment:

ZOverLord said...

There is nothing more redundant which uses more of your time, from one project to the next, than coding how your project is displayed at startup, what is shown during execution, NotifyIcon? Taskbar? When is a Taskbar displayed? During normal Display? When you are minimized? Your Context Menu logic, your exit logic, your deployment logic and your update logic.


Click here for more detail