HOWTO: Set this.Icon to App.ico in a windows form

  • Thread starter Thread starter Dan Sikorsky
  • Start date Start date
D

Dan Sikorsky

How do you set the this.Icon property of a windows form to the App.ico file
specified in the Project Properties? I don't want to type in the path and
filename; I want to set the form's icon programmatically in the Form Load
section.
 
Hi,

Try this...

System.Drawing.Icon ico = new System.Drawing.Icon("C:\\soaf.ico");
this.Icon = ico;

Hope this helps...

Cheers,
Madhu
 
Thanks for the example, but I explicitly requested a different solution:
How do you set the this.Icon property of a windows form to the App.ico file
specified in the Project Properties? I DON'T WANT TO TYPE IN THE PATH AND FILENAME;
I want to set the form's icon programmatically in the Form Load
section.

--

Thank you kindly,

Dan Sikorsky MSCS, BSCE, BAB
 
Back
Top