468,773 Members | 2,335 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,773 developers. It's quick & easy.

NotifyIcon Doesn't Disappear When Program Closes

VB.NET 2002 on Windows 2000 SP 3

When I start my program, the NotifyIcon appears in the tray, as it should.
However, when I close the program, the NotifyIcon remains until I hover over
it with my mouse. If I don't hover over it to make it disappear and then
open the program again, another one is added, resulting in a multiplicity of
the icon in the tray.

I've even tried setting its Visible property to false, followed by a call to
the Dispose method of the NotifyIcon in the Form1_Closing event, but the
NotifyIcon still remains when the program closes.

How can I get the NotifyIcon to disappear when I close my program? Thanks.
Jul 21 '05 #1
5 7050
Does it do this on all machines?

-smith

"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
VB.NET 2002 on Windows 2000 SP 3

When I start my program, the NotifyIcon appears in the tray, as it should.
However, when I close the program, the NotifyIcon remains until I hover
over
it with my mouse. If I don't hover over it to make it disappear and then
open the program again, another one is added, resulting in a multiplicity
of
the icon in the tray.

I've even tried setting its Visible property to false, followed by a call
to
the Dispose method of the NotifyIcon in the Form1_Closing event, but the
NotifyIcon still remains when the program closes.

How can I get the NotifyIcon to disappear when I close my program?
Thanks.

Jul 21 '05 #2
Simply explicitly remove the tray icon in the form closing event.
"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
VB.NET 2002 on Windows 2000 SP 3

When I start my program, the NotifyIcon appears in the tray, as it should.
However, when I close the program, the NotifyIcon remains until I hover over it with my mouse. If I don't hover over it to make it disappear and then
open the program again, another one is added, resulting in a multiplicity of the icon in the tray.

I've even tried setting its Visible property to false, followed by a call to the Dispose method of the NotifyIcon in the Form1_Closing event, but the
NotifyIcon still remains when the program closes.

How can I get the NotifyIcon to disappear when I close my program? Thanks.

Jul 21 '05 #3
I had previously attempted that method, i.e. explicitly referencing and
removing the icon from the tray. However, I was unable to determine how to
reference it. Do you know how it can be referenced? The word "Simply"
certainly sounds encouraging. Thanks.
"news.sbcglobal.net" <my********@pacbell.net> wrote in message
news:1E*******************@newssvr14.news.prodigy. com...
Simply explicitly remove the tray icon in the form closing event.
"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
VB.NET 2002 on Windows 2000 SP 3

When I start my program, the NotifyIcon appears in the tray, as it should. However, when I close the program, the NotifyIcon remains until I hover over
it with my mouse. If I don't hover over it to make it disappear and then open the program again, another one is added, resulting in a

multiplicity of
the icon in the tray.

I've even tried setting its Visible property to false, followed by a
call to
the Dispose method of the NotifyIcon in the Form1_Closing event, but the
NotifyIcon still remains when the program closes.

How can I get the NotifyIcon to disappear when I close my program?

Thanks.


Jul 21 '05 #4
VB.Net:

Protected Overrides Sub OnClosing(ByVal e As
System.ComponentModel.CancelEventArgs)

YourTrayIcon.Visible = False

YourTrayIcon.dispose 'propably don't need this.

End Sub

"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:Ox**************@TK2MSFTNGP12.phx.gbl...
I had previously attempted that method, i.e. explicitly referencing and
removing the icon from the tray. However, I was unable to determine how to reference it. Do you know how it can be referenced? The word "Simply"
certainly sounds encouraging. Thanks.
"news.sbcglobal.net" <my********@pacbell.net> wrote in message
news:1E*******************@newssvr14.news.prodigy. com...
Simply explicitly remove the tray icon in the form closing event.
"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
VB.NET 2002 on Windows 2000 SP 3

When I start my program, the NotifyIcon appears in the tray, as it should. However, when I close the program, the NotifyIcon remains until I hover
over
it with my mouse. If I don't hover over it to make it disappear and then open the program again, another one is added, resulting in a

multiplicity
of
the icon in the tray.

I've even tried setting its Visible property to false, followed by a

call
to
the Dispose method of the NotifyIcon in the Form1_Closing event, but

the NotifyIcon still remains when the program closes.

How can I get the NotifyIcon to disappear when I close my program?

Thanks.



Jul 21 '05 #5
Oh ... yea. That's what I did, as indicated in my initial posting (see
below). I thought you were saying you knew of a way of directly accessing
and removing icons in the System Tray.

But I think I discovered why NotifyIcon1.Visible = False in the OnClosing
event wasn't working. I was quitting the program from the VB.NET
development environment, so it wasn't triggering the OnClosing event.

Anyway, thanks.
"news.sbcglobal.net" <my********@pacbell.net> wrote in message
news:C_*******************@newssvr14.news.prodigy. com...
VB.Net:

Protected Overrides Sub OnClosing(ByVal e As
System.ComponentModel.CancelEventArgs)

YourTrayIcon.Visible = False

YourTrayIcon.dispose 'propably don't need this.

End Sub

"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:Ox**************@TK2MSFTNGP12.phx.gbl...
I had previously attempted that method, i.e. explicitly referencing and
removing the icon from the tray. However, I was unable to determine how

to
reference it. Do you know how it can be referenced? The word "Simply"
certainly sounds encouraging. Thanks.
"news.sbcglobal.net" <my********@pacbell.net> wrote in message
news:1E*******************@newssvr14.news.prodigy. com...
Simply explicitly remove the tray icon in the form closing event.
"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:eY**************@TK2MSFTNGP12.phx.gbl...
> VB.NET 2002 on Windows 2000 SP 3
>
> When I start my program, the NotifyIcon appears in the tray, as it

should.
> However, when I close the program, the NotifyIcon remains until I hover over
> it with my mouse. If I don't hover over it to make it disappear and

then
> open the program again, another one is added, resulting in a

multiplicity
of
> the icon in the tray.
>
> I've even tried setting its Visible property to false, followed by a

call
to
> the Dispose method of the NotifyIcon in the Form1_Closing event, but the > NotifyIcon still remains when the program closes.
>
> How can I get the NotifyIcon to disappear when I close my program?
Thanks.
>
>



Jul 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by petterl | last post: by
149 posts views Thread by Christopher Benson-Manica | last post: by
2 posts views Thread by Derrick | last post: by
2 posts views Thread by Erik Cole | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.