With an icon resource named Test2, this simple line works for me :
this.Icon = Properties.Resources.Test2;
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm trying to programmatically set my program's icons in code using an icon in the resources in C#. This code here doesn't work:
System.ComponentModel.ComponentResourceManager resources2 = new System.ComponentModel.ComponentResourceManager(typeof(TLS_FormMain));
this.Icon = (Icon)(resources2.GetObject("TLS_Icon_Green.ico"));
Neither does this code:
Icon programIcon = new Icon(typeof(TLS_FormMain), "TLS_Icon_Green.ico");
this.Icon = programIcon;
Any solutions?
With an icon resource named Test2, this simple line works for me :
this.Icon = Properties.Resources.Test2;