Add a Notify Icon control to your form (Under Common Controls) then do something like this
VB.NET:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide()
End If
End Sub
Anyone knows why sometimes my system tray icon keeps sitting in the tray
even when I closed my program. I have to hang over it to make it dissapear... I've tried dispose, visible=false,... when form is closing.....
Thought it would be nice to mention this here aswell.
There's not much code to it.
Like your example, I hide the form but the system tray icon only shows
when the user minimizes the form.(on purpose) Now whenever I close the form from my context menu or stop from designer the icon keeps hanging there until
I hover my mouse over it...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.