|
-
Oct 3rd, 2006, 01:52 PM
#1
Thread Starter
Lively Member
System tray icon Error
I am trying to add an icon to a system tray item.
when i type in the sample code im working from i get an error at this line.
VB Code:
Me.NotifyIcon1.Icon = CType([B][U]Resources.getObject[/U][/B]("NotifyIcon1.Icon"), System.Drawing.Icon)
The bold undeline tells me GetObject not a member of resources. THe code is exactly as it appears in my book. Im unsure what im missing..
The over all project is a form witha button, click button and make a system tray icon while hiding form.
Any help would be apreciated.
-
Oct 3rd, 2006, 01:56 PM
#2
Re: System tray icon Error
Which version are you using?
-
Oct 3rd, 2006, 02:15 PM
#3
Re: System tray icon Error
Ok, I am assuming you are using 2002 or 2003, so below is an example that should load the icon file as long as it is an item in your project, and you changed the icon file to be an embedded resource in the build action.
VB Code:
Me.NotifyIcon1.Icon = New Icon( _
System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream( _
"MyApp.myicon.ico"))
Replace the ""MyApp" string with your project name, and the "myicon.ico" with the name of your icon file, and it is case sensitive.
In 2005, you can just access the My.Resources object...
-
Oct 3rd, 2006, 03:30 PM
#4
Thread Starter
Lively Member
Re: System tray icon Error
Sorry i should have stated im using 2005. Perhaps its the fact that im using a 2003 book as refrence.. It works now... thank you.
-
Oct 3rd, 2006, 07:23 PM
#5
Re: System tray icon Error
WEll it should be easier in 2005. Just check out the project properties (right click project, go to properties), and theres a Resources section. You just add your icon to that, and then refer to it using My.Resources...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|