Question

I'm still learning C# and I'm stuck. My problem is that I have a tray icon, which has to be changed when somthing happens.

I have added the new icon as an existing item to the project and I'm trying to change it by using this code:

this.notifyIcon1.Icon = new Icon(GetType(), "newmailIcon.ico");

But I'm getting the following error:

Resource 'newmailIcon.ico' cannot be found in class 'Traym_Icon.Form1'.
Was it helpful?

Solution

You have to manually add your newmailIcon.ico as a resource file in your project.

OTHER TIPS

right click on your image, click propereties and at the Build action, choose Embed.

or create a .resx in which you will keep your icons.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top