How to create a resource file (C#, VS .NET 2003, Beginner's Level)

Posted on 2005-04-07
Medium Priority
Last Modified: 2010-05-18
Solution must be applicable to VS .NET 2003.

How do I create a resource file for a project which is accessible by all source files in the project?
Let say I want to store 2 text strings ("red", "blue") in this resource file.
After adding these 2 strings to the resource file, how do I retrieve them in my C# code?

string myColor = GetStringResource(0)??? (I need function name  for this call.)

Question by:rj94070

Assisted Solution

bman9111 earned 80 total points
ID: 13732618

Author Comment

ID: 13732706
No, bman9111. That's too complicated for what I want to do.
LVL 11

Assisted Solution

jatinderalagh earned 1480 total points
ID: 13733208
CheckOut this article which explains how to add resources and retrive them.


Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 13733658
That article gives me some of the info I need regarding retrieval.
What I want to know is how to create a resource file WITHOUT having to write a program.
How do I use a text editor to create the file? What is the format of the file, etc.?
LVL 10

Assisted Solution

by:Eduard Ghergu
Eduard Ghergu earned 440 total points
ID: 13734222
There is a tool provided by Microsoft with the source code for creating the .resource files. The name is ResEditor and you'll find it after a search over the Microsoft Visual Studio.NET installation folder.
LVL 11

Accepted Solution

jatinderalagh earned 1480 total points
ID: 13734229
The .NET Framework includes a sample application called ResEditor that facilitates creating and editing resource files. The ResEditor application allows you to create binary resource files (.resources) as well as XML resource files (.resX).

Building ResEditor
ResEditor is provided as source code with the .NET Framework SDK. Before you can use ResEditor, you must build it using the supplied batch file.

To build the ResEditor Application

1. Start Windows, and then click the Start button, point to All Programs, then Visual Studio .NET 2003, then Visual Studio .NET Tools, then Visual Studio .NET Command Prompt to open the Visual Studio .NET command prompt.

2. At the command prompt, change the directory to the SDK\v1.1\Samples\Tutorials\resourcesandlocalization\reseditor folder as shown below:
cd \Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Samples\Tutorials\resourcesandlocalization\reseditor

3. At the command prompt, type Build, then press the ENTER key to build the application.
ResEditor is built and the executable is placed in the \Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\reseditor folder.

The Resource File Generator ( ResGen .exe ) converts .txt files and .resx (XML-based resource format) files to common language runtime binary .resources files that can be embedded in a runtime binary executable or compiled into satellite assemblies.

Author Comment

ID: 13740576
Thanks, jatinderalagh. I think that reseditor is what I need. Great job.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn different types of Android Layout and some basics of an Android App.
Screencast - Getting to Know the Pipeline

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question