I”ve been playing around with the NotifyIcon class within C# recently but been having one major issue with it. The class itself allows you to place an icon in the systray (down by the clock) and for it to display the standard balloon tip dialog.
However, the problem I was having is that when my calling parent closed my NotifyIcon would still be in my SysTray. The only time it was removed was when I hovered over the icon with my mouse, then it would automatically disappear. Not great from the users point of view!
The code is shown below, the notifyIcon variable is a member variable (private NotifyIcon m_notify;)
protected override void Dispose(bool disposing)
if(m_notify != null)
m_notify.Visible = false;
m_notify = null;
if (disposing && (components != null))
After inserting this code, when my parent form is closed the notify icon also disappears. This took me a while to find out about, hopefully I have saved you some time.