Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to create text file for Resource file

How to create text file for Resource file

Scheduled Pinned Locked Moved C#
helptutoriallearning
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Inpreet Singh
    wrote on last edited by
    #1

    Hi, I want to use resource files to store message box strings. Which I read that I can by defining Name = value pair in text file. like ex > Close = "Really wann quit this application". But now the problem is where should I wirte this text file and then where should I compile Resgen myResource.txt , to create myResource.resource file. Now after doing all this how should I use these Name of string in my application to call resource file. Thanx for ur support. Inpreet Singh

    H 1 Reply Last reply
    0
    • I Inpreet Singh

      Hi, I want to use resource files to store message box strings. Which I read that I can by defining Name = value pair in text file. like ex > Close = "Really wann quit this application". But now the problem is where should I wirte this text file and then where should I compile Resgen myResource.txt , to create myResource.resource file. Now after doing all this how should I use these Name of string in my application to call resource file. Thanx for ur support. Inpreet Singh

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      As I've been trying to tell you in an old thread, use a ResX file in VS.NET instead and mark it as an embedded resource. Forms and controls already have a hidden ResX file associated with them. You can use .txt files but you'll have to compile them manually - like I also said before - using resgen.exe to the appropriate name (fully-qualified name) and embedding them with the csc.exe compiler using the /res option. If you use a ResX file, you can centralize/localize more than just string resources, including various structs and classes that have a TypeConverter associated with them. I also gave you a link to check out that shows MANY examples of using the ResourceManager and even a code snippet, which I'll post again:

      ResourceManager resources = new ResourceManager(typeof(SomeClass));

      Use the code above is a .resources file would have the same namespace and name (fully-qualified name) as a class. If now, you have to use the name and get the assembly, something like:ResourceManager resources = new ResourceManager("MyResources.resources", this.GetType().Assembly);...where `this` is an instance of your class that will use the resources. You need to get the `Assembly` and this is one of many ways to do it (one of the faster ways). Here's [that link](http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemResourcesResourceManagerClassTopic.asp)[[^](http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemResourcesResourceManagerClassTopic.asp "New Window")] again for the `ResourceManager` class. Microsoft MVP, Visual C# [My Articles](http://www.codeproject.com/script/articles/list_articles.asp?userid=46969)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups