Resolved NotifyIcon question

aaaron

Well-known member
Joined
Jan 23, 2011
Messages
219
Programming Experience
10+
I have a solution that contains some Forms with code like the following.
There is a different icon for the app that shows in the taskbar.
This appears to be the only NotiftIcon_1 mention in the project.

What could this posibly be for?

VB.NET:
In:   Designer.vb  
         Me.NotifyIcon_1 = New System.Windows.Forms.NotifyIcon(Me.components)    
        ' NotifyIcon_1    
        Me.NotifyIcon_1.Text = "1"    
        Me.NotifyIcon_1.Visible = True    
        Friend WithEvents NotifyIcon_1 As System.Windows.Forms.NotifyIcon        
In:  .resv
       <metadata name="NotifyIcon_1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
 
Solution
Do you understand what a NotifyIcon does? If not then you should read up on it. It displays an icon to represent your app in the Windows notification area, commonly called the system tray. Based on that code, it looks like it's visible but is not displaying any icon, so there's probably a bit of empty space there. Try mousing over the tray and see if there is some space that displays that text in a tool tip. Based on the text, it looks like it was for no more than testing at the stage it was left.
Do you understand what a NotifyIcon does? If not then you should read up on it. It displays an icon to represent your app in the Windows notification area, commonly called the system tray. Based on that code, it looks like it's visible but is not displaying any icon, so there's probably a bit of empty space there. Try mousing over the tray and see if there is some space that displays that text in a tool tip. Based on the text, it looks like it was for no more than testing at the stage it was left.
 
Solution
Thanks,

The icon that shows in the taskbar comes from a setting in the MDI form's properties. It shows up as soon as the app starts an never changes (until the app ends).

The code I showed comes from a different form.

Also, what does the line cntaining Me.Components do?

Also there does not seen to be a MotifyIcon.Icon property? Is that OK?

I don't see anything in the systemtray. Should an icon show when the form with the above code is visiable?
 
Last edited:
I'm not talking about the main area of the task bar. I'm talking about the system tray, i.e. the area by the clock. What's displayed in the task bar is irrelevant.

The line containing Me.components is where the NotifyIcon object is created. That's why it's using the New keyword to invoke a constructor. Not really something that should need explaining. Any beginners tutorial will cover constructors.

I specifically stated that that code will not display an icon. At best, it will display an effort space where an icon should be. I would have to test for myself to see what happens in that case, which I can't do right now.

Do you want an icon in the tray or not? If you don't then just get rid of that NotifyIcon and this all becomes moot. If you do want one then configure it properly and it will display properly.
 
Also, don't use your email address as visible forum nickname; it gives web scraping spammers an easy ride
 
How do I create a nickname

It's a little concerning that a software developer needs to be shown how to use the internet. Have you never managed a user account on a web site before? I would suggest that you explore any site like this one that you use to see what is available to you. Managing your profile is pretty much the same everywhere, but there will almost certainly be some variation in the details.
 

Latest posts

Back
Top