You shouldn't need to do that. I am working on an app right now that lives in the system tray, and I have the
Form.ShowInTaskBar
property set to false - it never shows up there at all.
If you're saying that the icon remains IN THE SYSTEM TRAY after closing the app, you could try this code in your form:
protected override void Dispose(bool disposing)
{
if (disposing)
{
this.notifyIcon1.Dispose();
}
base.Dispose(disposing);
}
What I've found is that if you drag a
NotifyIcon
control onto your form in the designer, the Dispose method in your designer.cs file will properly dispose it when the app closes. HOWEVER, if you add it manually to your .cs file, you have to add the line that specifically disposes your
notifyIcon
to the Dispose method in your designer.cs file.