Frage

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'.
War es hilfreich?

Lösung

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

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top