none
Resources.resx

    Question

  • I can't seem to find any information on how to use the Resources.resx file.

    I basically want to be able to store path data and connection strings in the file so that I can change them easily when I run my app on the live system, I thought the Resources.resx file would be my best option for this.

    Does anyone have any info on how to use this with C#?

    Thanks,
    Russ

    Friday, September 15, 2006 7:59 PM

Answers

  • Check out this article in MSDN magazine Basic Instincts: Resources and Localization

    otherwise, you may want to use the settings, instead of the resource. Right click the project in the Solution explorer. Select properties and go to settings. If it asks to set one up do it. Create a Application level string....name it ABCD with text This is it.

    To reference ABCD in code use this:

    string it = {Application Name}.Properties.Settings.Default.ABCD;

    Read up on settings here Application Settings
    Friday, September 15, 2006 8:30 PM

All replies

  • Check out this article in MSDN magazine Basic Instincts: Resources and Localization

    otherwise, you may want to use the settings, instead of the resource. Right click the project in the Solution explorer. Select properties and go to settings. If it asks to set one up do it. Create a Application level string....name it ABCD with text This is it.

    To reference ABCD in code use this:

    string it = {Application Name}.Properties.Settings.Default.ABCD;

    Read up on settings here Application Settings
    Friday, September 15, 2006 8:30 PM
  • OmegaMan is correct. If you want to be able to configure your application after you have deployed it, you want to use settings and not resource.

    In addition do OmegaMan's link, there is also an article here: http://msdn.microsoft.com/vcsharp/default.aspx?pull=/library/en-us/dnvs05/html/settingscs_rl.asp

    Best regards,
    Johan Stenberg

    Friday, September 15, 2006 11:15 PM
  • Worked perfectly, thanks a lot.
    Monday, September 18, 2006 6:37 PM
  • I have just finished the development of a free tool that I call ResEx, composite, translation friendly resource editor for .NET.
    It is a free tool and I intend to keep it free, containing all current features. A small charge may be applied for some features I may introduce later, just to help me keep supporting and enhancing the project.
    I encourage you to download ResEx and post any suggestions to the discussions page you can find under Help menu of the application. Info and download
    Here is a list of features provided by ResEx:17
    •     Translate values side by side (just like the old time classic VB6 resource editor)
    •     Lock specific strings so that translator does not translate them
    •     Ensure correct translation of strings with placeholders {0} {1} ...
    •     View resource strings in tree form
    •     Translate resources without Visual Studio IDE
    •     Search inside resource files while translating
    Regards
    Sunday, March 04, 2007 8:07 PM
  • If you are using the Default Resources.resx file present when you created the application.

    You can do the following.
    string resourceValue = {Application Namespace}.Properties.Resources.ResourceKey

    //with default localization
    string resourceValue = {Application Namespace}.Properties.Resources.ResourceManager.GetString("ResourceKey");


    //with localization
    string resourceValue = {Application Namespace}.Properties.Resources.ResourceManager.GetString("ResourceKey", System.Threading.Thread.CurrentThread.CurrentUICulture);

    Monday, July 27, 2009 5:10 AM