467,886 Members | 1,773 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Dispose of Notifier Icon

Thank you in advance for any and all assistance.

I have an application that places a notifier icon in the start tray. When
the application closes, the icon appears to stay, till I place my mouse over
it and then it will disappear. Can someone point in the direction of code to
dispose of the notifier icon when the application closes?

Michael
Jul 24 '06 #1
  • viewed: 1377
Share:
6 Replies
you can either, in your formClosing even, say

Me.NotifyIcon1.Visible = False

in VB2005 i believe there is an application exit event...., so you could
also say that in there
--
-iwdu15
Jul 24 '06 #2
iwdu15

Keep it by your first answer, don't tell what you believe is. :-)

There are almost 10 methods to start a VB application.

If you use the standard method than the application exit is standard done in
your main form as that closes

If you write your own Sub Main to let the application run, than you have to
end that with application.exit.
(this is the method as by instance Herfried always shows)

Just what I thought reading your message.

Cor

"iwdu15" <jmmgoalsteratyahoodotcomschreef in bericht
news:64**********************************@microsof t.com...
you can either, in your formClosing even, say

Me.NotifyIcon1.Visible = False

in VB2005 i believe there is an application exit event...., so you could
also say that in there
--
-iwdu15

Jul 25 '06 #3
Iwdu15,
Just what I thought reading your message.
Maybe should I add: and am happy with the correct way you are helping
others.

:-)

Cor

"Cor Ligthert [MVP]" <no************@planet.nlschreef in bericht
news:Ok**************@TK2MSFTNGP04.phx.gbl...
iwdu15

Keep it by your first answer, don't tell what you believe is. :-)

There are almost 10 methods to start a VB application.

If you use the standard method than the application exit is standard done
in your main form as that closes

If you write your own Sub Main to let the application run, than you have
to end that with application.exit.
(this is the method as by instance Herfried always shows)

Just what I thought reading your message.

Cor

"iwdu15" <jmmgoalsteratyahoodotcomschreef in bericht
news:64**********************************@microsof t.com...
>you can either, in your formClosing even, say

Me.NotifyIcon1.Visible = False

in VB2005 i believe there is an application exit event...., so you could
also say that in there
--
-iwdu15


Jul 25 '06 #4
Michael,
In addition to the other comments.

Be certain to call Dispose on the NotifyIcon when you app exits, this
ensures that any unmanaged resources its holding are cleaned up. I would not
use the visible = false method as that is "hiding the icon" rather then
"clean up the resources"...

Do you have an forms application that happens to have a notify icon, or do
you happen to have a notify icon that happens to have a form?

When I have a notify icon that happens to have a form I normally do
something like:
http://groups.google.com/group/micro...48f2baa27752c8

http://groups.google.com/group/micro...98f02af50ca7de

http://groups.google.com/group/micro...b0f2a27479a427

If I had a forms application that happens to have a notify icon, I would be
certain to call dispose of the icon when the form closed (or the application
exited).

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"eSolTec, Inc. 501(c)(3)" <eS*************@discussions.microsoft.comwrote
in message news:8A**********************************@microsof t.com...
| Thank you in advance for any and all assistance.
|
| I have an application that places a notifier icon in the start tray. When
| the application closes, the icon appears to stay, till I place my mouse
over
| it and then it will disappear. Can someone point in the direction of code
to
| dispose of the notifier icon when the application closes?
|
| Michael
Jul 25 '06 #5
just a question for you, i havent done much reading on the memory management
of VB, but i was under the impression that VB was managed by the GC, so when
the application exits, there isnt anything associated with the NotifyIcon
object so the GC would collect it and release the resources....am i following
this wrong?
--
-iwdu15
Jul 25 '06 #6
iwdu15,
Yes managed resources are "managed" by the GC.

However NotifyIcon represents an unmanaged resource. The GC doesn't really
manage unmanaged resources.

Also remember that the GC, more appropriately any Finalizers may not execute
when the app exits. Ergo its best to call NotifyIcon.Dispose when you are
exiting.

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"iwdu15" <jmmgoalsteratyahoodotcomwrote in message
news:C2**********************************@microsof t.com...
| just a question for you, i havent done much reading on the memory
management
| of VB, but i was under the impression that VB was managed by the GC, so
when
| the application exits, there isnt anything associated with the NotifyIcon
| object so the GC would collect it and release the resources....am i
following
| this wrong?
| --
| -iwdu15
Jul 25 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Vic | last post: by
8 posts views Thread by Adrian | last post: by
3 posts views Thread by Nina | last post: by
reply views Thread by Smokey Grindle | last post: by
2 posts views Thread by pigeonrandle | last post: by
4 posts views Thread by Marcolino | last post: by
1 post views Thread by sean.chapman | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.