NotifyIcon stays on taskbar when app closes in visual basic 2010
NotifyIcon stays on 开发者_运维百科taskbar when application closed, then when I move mouseover it, it disappears.
I tried this on shutdown,
Private Sub MyApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
Form2.NotifyIcon1.Visible = False
Form2.NotifyIcon1.Dispose()
End Sub
It still stays, any suggestion on this ?
thanks
Check Issue with NotifyIcon not dissappearing on Winforms App
For me, it works when calling Application.DoEvents()
after settings Icon
to null
and disposing the NotifyIcon
.
Private Sub MyApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
Form2.NotifyIcon1.Icon = Nothing;
Form2.NotifyIcon1.Dispose()
System.Windows.Forms.Application.DoEvents()
End Sub
精彩评论