473,698 Members | 2,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 programmaticall y in the Form Load
section.

--

Thank you kindly,

Dan Sikorsky MSCS, BSCE, BAB


Nov 16 '05 #1
4 23827
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 programmaticall y 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 programmaticall y 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******** ******@TK2MSFTN GP09.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 programmaticall y 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 programmaticall y in the Form Load
section.
--

Thank you kindly,

Dan Sikorsky MSCS, BSCE, BAB

"Madhu[C#-MVP]" <Ma*******@disc ussions.microso ft.com> wrote in message
news:41******** *************** ***********@mic rosoft.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 programmaticall y 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
49910
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 webbrowser with a URL as a query parameter. Thanks, /m
0
1027
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). English is the default language of the Form. Can I do something so that the French image is the same as the English one? I probably messed up one day, so that the Windows Form thinks the French image is different. I really can't imagine a...
2
4531
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 several minutes to load this form in the form designer when I double click on the . file in the Visual Studio .NET Solution Explorer. It gets worse with another form that has more controls. It gets really dramatic when I try to compile in...
1
1443
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 development machine. The problem is that on other machines with the same framework version the control does not render. I set all of the activex security settings in the browser (on the other machines ) to enable signed or unsigned controls. I did...
5
2356
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 one go about doing this in the main form, once the DLL has been loaded? Thanks in advance. Tom --
3
3647
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
1576
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 HTML snippets contain <objecttags for ActiveX Control. ActiveX Control loads and works without issue. VB.NET App Architecture: SAME as above except for: The WebBrowser Control is initially seeded by loading HTML from local disk. All Other
3
2521
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
2309
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 the new form as Form1 but when I renamed it to the origianl forms name and click the save icon, Access closed. The form is based on a table that has several combo boxes. FWIW the table is
0
8683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8876
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.