473,387 Members | 3,820 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,387 software developers and data experts.

Using resource file

Hi,
I want to create a resource file with 2 icons and then use them in a c#
project. First I create the resx file with reseditor.exe. After that I add
the resx-file into my project and then I try to get the icon by using the
code:

Assembly a = Assembly.GetExecutingAssembly();
ResourceManager rm = new ResourceManager("Resource1", a);

Icon i = (Icon) rm.GetObject("Running");

However, this does not work. I get an error saying something about a
manifest and that I must make sure that all files were added correctly.

Can anyone give me a step by step explanation on how I should do it?

Thanks,

Mats-Lennart
Nov 16 '05 #1
1 4536
Thanks, but your example uses an jpg and I want to use an icon (.ico). Is
there a similar way for icons as well?

Thanks,
Mats-Lennart

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:#E**************@TK2MSFTNGP11.phx.gbl...
Mats-Lennart,

For culture-neutral items, I generally don't use the Resource manager
(especially for pictures and whatnot). I just read the stream directly.

Attached is a sample app that shows you how to read the resource stream, as well as how to include it in your project.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mats-Lennart Hansson" <ap********@hotmail.com> wrote in message
news:eQ**************@TK2MSFTNGP15.phx.gbl...
Hi,
I want to create a resource file with 2 icons and then use them in a c#
project. First I create the resx file with reseditor.exe. After that I add the resx-file into my project and then I try to get the icon by using the code:

Assembly a = Assembly.GetExecutingAssembly();
ResourceManager rm = new ResourceManager("Resource1", a);

Icon i = (Icon) rm.GetObject("Running");

However, this does not work. I get an error saying something about a
manifest and that I must make sure that all files were added correctly.

Can anyone give me a step by step explanation on how I should do it?

Thanks,

Mats-Lennart


Nov 16 '05 #2

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

Similar topics

0
by: Ben Jones | last post by:
Hi there, I am looking into the ease of implementing the localization/globalization features of .NET using C#. I have a test app which creates a ResourceManager and attempts to load a resource...
1
by: Bilal Farooq via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Bilal Farooq Hi, I have following requirements to achieve: I have some images andI am adding them as a resource to a dll....
3
by: J.Marsch | last post by:
Hello all: I am trying to build a resource dll that will house icons, and I'm afraid that I'm not having much luck reading it. Can you lend hand (or just point me to a good primer). Here's...
5
by: Mukesh | last post by:
Hi i want to use AJAX.net in my Existing Application I have already installed the ajax .net ..net 3.0 and using VS 2005 in the old application i have added a new web form then script manager...
2
by: Daniel | last post by:
I am just investigating on .resx and .resource files using asp.net. I am attempting to develop a webpage in Dreamweaver on an asp.net webserver. As i read around the net, using a .resource file...
0
by: =?Utf-8?B?cHJhc2hhbnQga3VtYXIgc3JpdmFzdGF2YQ==?= | last post by:
Hi all, I m using asp.net 2.0 version and want to retrieve the particular string from resource file dynamically... Following is the my code ... but in this every time I get exception that...
0
by: =?Utf-8?B?cHJhc2hhbnQga3VtYXIgc3JpdmFzdGF2YQ==?= | last post by:
Hi all, I m using asp.net 2.0 version and want to retrieve the particular string from resource file dynamically... Following is the my code ... but in this every time I get exception that...
2
by: Andrus | last post by:
I have resource files in different languages created by VCS 2005 Express. I want to use those files to translate reports at runtime. I have text to be translated as string. I think I need to...
2
by: Nathan Sokalski | last post by:
I am attempting to create icons for controls I have created using VB.NET by using the System.Drawing.ToolboxBitmap attribute. I have managed to do this in C# by specifying the path to the *.ico...
2
by: yxq | last post by:
I want to add some elements to a XML file using XmlDocument, how to do? thank you very much. The original XML file like: //////////////////////////////////////////////////////// <?xml...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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,...

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.