473,657 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trying to retrieve icon from resources.resx

(I'm using C# 2.0)

Hi,

I have placed an icon file in resources.resx. The problem is that I don't
know how to retrieve it.

In VB.NET 2.0, My.Resources.My Icon does the trick, but what's the C#
equivalent? Unfortunately, what happens under the hood with the My
namespace is not well documented. Reflector on Microsoft.Visua lBasic.dll
didn't help either.

Can anyone help me on this? Here's my code:

protected System.Drawing. Icon GetIcon()
{
Assembly a = Assembly.GetCal lingAssembly();
Stream stream = null;
Icon icon = null;
try
{
stream = a.GetManifestRe sourceStream("M yIcon.ico");
icon = new Icon(stream);
return icon;
}
catch {
return null;
}
}
Nov 17 '05 #1
0 1671

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

Similar topics

2
1499
by: sommwerweide | last post by:
I have created an simple visual basic windows application with the visual studio 2003. But i want to compile this with the vbc compiler (.Net framework 1.1 SP1) an not with the visual studio. Now i have the following issue: My form is using an icon, which i have defined in the properties of this form. ########################################################################## Resgen Form2.resx Form2.resources
15
3632
by: kurt sune | last post by:
Anybody has a tip of where to find info/example how to retrieve an icon from a .RESX-file? /k
1
3355
by: urban.john | last post by:
Here are my steps: create resource files from resx files: <echo message="CREATING RESOURCE FILES FROM RESGEN EN" /> <resgen todir="product\resources_en" verbose="true"> <resources> <include name="${AppName}\**.en.resx" /> <include name="${AppName}\Global.asax.resx" /> </resources>
4
6547
by: randy1200 | last post by:
I have a Windows application that previously had the company logo "MyCompany.ico" added to the upper left-most corner. The company has since issued a new version of "MyCompany.ico" that looks completely different. I overwrote the old ico file with the new ico file and re-ran the program. I still see the old logo at run-time. I right-clicked the project-> Add Existing Item-> added the new ico file. I set the build action to Embedded...
2
1346
by: James Arnold | last post by:
Is there any way to set the forms icon to one stored in the resources at design time? Currently I am using the following code in the FormLoad event to set it at run time: Me.Icon = My.Resources.FormIcon You can set images in resources to buttons and pictureboxes etc at design time, why not icons?
2
1675
by: kelvin.koogan | last post by:
I want to dynamically change the icon displayed in a status bar panel. I've created the icons in the resource file, app.rc, e.g. IDI_MYICON. How can I load this icon and display it in the StatusBarPanel? The auto-generated code does: this->StatusBarPanel->Icon = (__try_cast<System::Drawing::Icon * But this loads the icon from form1.resX and the icons I've defined aren't in there.
7
12277
by: nws_reader | last post by:
I have a web service that needs to return a particular string for one of its web methods. I would like to manage the strings in a resource file. I went through a lot of the help provided on the net and can't seem to get it to work. Can someone with expertise assure me this is possible as a Web Service (using C#)? If so, can someone provide the steps on how to get this working?
5
9441
by: =?Utf-8?B?QXhlbCBEYWhtZW4=?= | last post by:
Hi, I've created a class library assembly containing several string resource files, like: - TableColumns.resx - TableColumns.de.resx - General.resx - General.de.resx
2
4673
by: bahnfire | last post by:
Hi, I am hoping that I finally have the right group :-) I am using Visual C++ Express 2008 and am trying to change the taskbar icon that I am using (notifyIcon1) as some state changes (button press, etc) in my form/app. I have read that I can use imageList1 and have the following: //
0
8403
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
8316
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8737
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...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
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
4168
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
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
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.