• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 490
  • Last Modified:

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

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.)

Thanks.
0
rj94070
Asked:
rj94070
4 Solutions
 
rj94070Author Commented:
No, bman9111. That's too complicated for what I want to do.
0
 
jatinderalaghCommented:
CheckOut this article which explains how to add resources and retrive them.

http://www.funducode.com/csharpart/csarticle19.htm

HTH
jatinder
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
rj94070Author Commented:
Jatinder,
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.?
Thanks.
0
 
Eduard GherguLeader SibiuCommented:
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.
0
 
jatinderalaghCommented:
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.
0
 
rj94070Author Commented:
Thanks, jatinderalagh. I think that reseditor is what I need. Great job.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now