Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 481
  • Last Modified:

NotifyIcon in SysTray won't go away after program is closed unless you move your cursor over it

I have an app that has a NotifyIcon in the system tray.  When I close the program by a button tied to the End command, my app closes but the Icon stays in the system tray until I move my mouse over the system tray.  
Is there any way to clear the Icon out of the system tray when the app is closed?
  • 2
1 Solution
You could use the Form.Closing event in your main form.  In it, you could hide the NotifyIcon so that it disappears before the application closes.
jettman26Author Commented:
I tried the following but it didn't work.

Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
        NotifyIcon1.Visible = False
    End Sub
jettman26Author Commented:
I got it to work.  I was setting the NotifyIcon1.Visible property in the wrong spot.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now