473,406 Members | 2,710 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,406 software developers and data experts.

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.MyIcon 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.VisualBasic.dll
didn't help either.

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

protected System.Drawing.Icon GetIcon()
{
Assembly a = Assembly.GetCallingAssembly();
Stream stream = null;
Icon icon = null;
try
{
stream = a.GetManifestResourceStream("MyIcon.ico");
icon = new Icon(stream);
return icon;
}
catch {
return null;
}
}
Nov 17 '05 #1
0 1657

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

Similar topics

2
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...
15
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
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...
4
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...
2
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 =...
2
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...
7
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...
5
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
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...
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
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
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
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...
0
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...
0
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,...
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.