Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB

Remove Notifyicon from system tray

3.42/5 (11 votes)
28 Jul 2011CPOL 38.2K  
Remove Notifyicon from system tray while closing the application from external application (killing proccess from another application)
I used NotifyIcon in one application and it's running. The icon showing in system tray. When i close my application directly, the NotifyIcon also not visible. Because i called NotifyIcon.Dispose() method in form_Closed method.

But I close my application through external application. That is find the Process and kill that process. So my application was closed, but NotifyIcon is not removed from system tray.
Previously i used ProcessName.Kill(), now it's changed to
ProcessName.CloseMainWindow()
Then close the my application and NotifyIcon from system tray also.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)