473,408 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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

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


Nov 16 '05 #1
4 23778
Hi,

Try this...

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

Hope this helps...

Cheers,
Madhu

"Dan Sikorsky" wrote:
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


Nov 16 '05 #2
First you need to set the BuildAction property of the App.ico file to
Embedded resource, then you can use the ResourceManager class to set the
icon for your form.

Let me know if you get stuck.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Dan Sikorsky wrote:
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.

Nov 16 '05 #3
Thanks ... this works good.

--

Thank you kindly,

Dan Sikorsky MSCS, BSCE, BAB

"Sijin Joseph" <si***************@hotmail.com> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
First you need to set the BuildAction property of the App.ico file to
Embedded resource, then you can use the ResourceManager class to set the
icon for your form.

Let me know if you get stuck.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Dan Sikorsky wrote:
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.

Nov 16 '05 #4
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

"Madhu[C#-MVP]" <Ma*******@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com... Hi,

Try this...

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

Hope this helps...

Cheers,
Madhu

"Dan Sikorsky" wrote:
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


Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Muscha | last post by:
Hi, On an ASP.Net I can use UrlEncode() method to encode a URL that I want to forward using respnose.redirect, what's the equivalent of this in Windows Form? I want to be able to do open a...
0
by: Anonymous | last post by:
I have a Windows Form with a graphic on it (an icon on a toolbar). My form is localized in English and French. I modified the English version image, the French version stayed the same (old image)....
2
by: JC Carette | last post by:
Hello I am experiencing extremely long time for loading a windows form in my Visual C++ .NET project This Windows form has just 40 labels, 4 checkBoxes, 2 buttons and 11 numericUpDown. It takes...
1
by: Brent Jenny | last post by:
I have created a simple windows form control using C# based on the following article. http://www.devhood.com/tutorials/tutorial_details.aspx?utorial_id=388&printer=t It works fine on my...
5
by: Tom | last post by:
I have a main VB.NET application that loads another VB.NET DLL dynamically. Once I have done that, I would like to be able to 'get' the icon of a form in that dynamically loaded DLL. How would...
3
by: Dennis | last post by:
I would like to host a word document in a windows form. Can anyone give me any guidance on how to do this, i.e., a control that accepts and displays a word document? -- Dennis in Houston
0
by: Mark | last post by:
I am converting a VB6/COM application to VB.NET and must remove all COM objects. VB6/COM App Architecture: Windows Form hosts WebBrowser which loads HTML snippets from local disk. Some of the...
3
by: Alan T | last post by:
I want to put an icon on a Windows Form top left hand corner but would like to hide the maximize and close box on the top right hand corner. Can I do that?
2
by: Karl | last post by:
Using A2000 When I click the save icon in form design, Access closes immediately. No warning messges, nothing. This happens on only one form. I deleted the form and recreated it. I could save...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.