473,569 Members | 2,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
6 1557
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.exi t.
(this is the method as by instance Herfried always shows)

Just what I thought reading your message.

Cor

"iwdu15" <jmmgoalsteraty ahoodotcomschre ef in bericht
news:64******** *************** ***********@mic rosoft.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.nlschre ef in bericht
news:Ok******** ******@TK2MSFTN GP04.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.exi t.
(this is the method as by instance Herfried always shows)

Just what I thought reading your message.

Cor

"iwdu15" <jmmgoalsteraty ahoodotcomschre ef in bericht
news:64******** *************** ***********@mic rosoft.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.m icrosoft.comwro te
in message news:8A******** *************** ***********@mic rosoft.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.Disp ose 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" <jmmgoalsteraty ahoodotcomwrote in message
news:C2******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9433
by: Vic | last post by:
I am trying to change an icon associated with my application's main form and the application itself. 1. I selected my main form in IDE "Solution" tab and went to "Properties" window. 2. I found "Icon" property, browsed for and selected a new icon. 3. I noticed the icon changed on my form 4. Ran my application and sure thing, the new icon...
8
2270
by: Adrian | last post by:
How do I put an icon on a form using code? Thank you.
3
2846
by: Nina | last post by:
Hi there, I assigned icon for a window's form using form's Icon property at design time. Now I want to change the icon. I tried to replace the old icon with the new icon using form's Icon property. Somehow in the form's property window's Icon property has changed to new icon, but on the form it still uses the old icon. Then I tried...
0
1495
by: Smokey Grindle | last post by:
I keep getting this message System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Icon'. at System.Drawing.Icon.get_Handle() at System.Drawing.Icon.get_Size()
3
6318
by: Tom | last post by:
I am having a serious issue with my MDI child windows. This is with a large VB.NET application that I ported over to VS 2005 from VS 2003. The problem is that, if the child window is maximized and then closed, it produces the following error message: Cannot access a disposed object Object name:'icon' in source System.Drawing And then the...
2
1381
by: pigeonrandle | last post by:
Hi, I have a class with a handle to a window and a handle to its icon (if it has one). What do i need to do to correctly free these resources when my class is disposed? Cheers, James.
2
5772
by: deciacco | last post by:
I have a NotifyIcon application. (c# 2) I want to be able to catch a kill/shutdown attempt so that I can call Dispose() to remove the icon. I tried to create an event handler for ApplicationExit and put my icon dispose call in there, but when process.kill() is called from an outside app on the notifyicon app, the event doesn't get raised. the...
4
5011
by: Marcolino | last post by:
Hi, I have simple needs but I don't know how to implement it. I have application that create Dynamic Button. I need to set the image on this button, getting the icon from a form. So pratically I need to convert dinamically a Form.Icon to Button.Image runtime, but i don't know how. Any help would be appreciated. Many Thanks
1
1400
by: sean.chapman | last post by:
I've got a portion of this program that has a timer setup. On the interval I am checking to see if some stuff is changed then want to play the exclamation sound until it has been noticed and acknowledged by the user. void flashTimer_Tick(object sender, EventArgs e) { if (pictureYes.Visible == true) { if (chkAlarm.Checked)
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.