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. Resources.resx

Resources.resx

Scheduled Pinned Locked Moved C#
databasetutorialquestion
14 Posts 5 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.
  • J Offline
    J Offline
    JacquesDP
    wrote on last edited by
    #1

    I'm playing around with resources files, adding images to them etc, but I saw that you can also add string values to it, how advisable would it be to add a connection string in that, for example database connection string? Thanks in advance

    He who laughs last is a bit on the slow side

    A S P 3 Replies Last reply
    0
    • J JacquesDP

      I'm playing around with resources files, adding images to them etc, but I saw that you can also add string values to it, how advisable would it be to add a connection string in that, for example database connection string? Thanks in advance

      He who laughs last is a bit on the slow side

      A Offline
      A Offline
      Ashvin Gunga
      wrote on last edited by
      #2

      Hello, Can you give additional information what you want to achieve? I have used resource files (for the string values) mainly dealing with the localization issues, whereby my application interface has to be in difference languages etc, and resource files provide great help. Otherwise, using resource files to keep your images etc..embeds the resources in your assembly, thus you won't need any other extra files such as .jpg etc.. The connection string can be a constant in your code as well. Does this help?

      Ashvin Gunga

      J 1 Reply Last reply
      0
      • J JacquesDP

        I'm playing around with resources files, adding images to them etc, but I saw that you can also add string values to it, how advisable would it be to add a connection string in that, for example database connection string? Thanks in advance

        He who laughs last is a bit on the slow side

        S Offline
        S Offline
        Scott Dorman
        wrote on last edited by
        #3

        Usually this type of data would go in the app.config file. That allows it to be changed without a recompile, and also allows it to be encrypted (although that limits how easily it can be changed.)

        ----------------------------- In just two days, tomorrow will be yesterday.

        J 1 Reply Last reply
        0
        • J JacquesDP

          I'm playing around with resources files, adding images to them etc, but I saw that you can also add string values to it, how advisable would it be to add a connection string in that, for example database connection string? Thanks in advance

          He who laughs last is a bit on the slow side

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Unless the connection string is never going to change, it isn't a good idea to put it into a resources file. The resources file requires a recompilation to cope with changes to it. You really should look at using the humble config file for storing connection strings.

          Deja View - the feeling that you've seen this post before.

          1 Reply Last reply
          0
          • A Ashvin Gunga

            Hello, Can you give additional information what you want to achieve? I have used resource files (for the string values) mainly dealing with the localization issues, whereby my application interface has to be in difference languages etc, and resource files provide great help. Otherwise, using resource files to keep your images etc..embeds the resources in your assembly, thus you won't need any other extra files such as .jpg etc.. The connection string can be a constant in your code as well. Does this help?

            Ashvin Gunga

            J Offline
            J Offline
            JacquesDP
            wrote on last edited by
            #5

            Ashvin Gunga wrote:

            Can you give additional information what you want to achieve?

            I learning myself C# and came across this, so there's nothing I want or need to do, just wondered how it worked and what it is for. The fact that you can load icons and images appealed to me because I didn't need to include them to the solution, just added them to the resource file and reference them from there. That's when I came across the strings you could save and wondered what type of string you would save in there

            He who laughs last is a bit on the slow side

            P 1 Reply Last reply
            0
            • S Scott Dorman

              Usually this type of data would go in the app.config file. That allows it to be changed without a recompile, and also allows it to be encrypted (although that limits how easily it can be changed.)

              ----------------------------- In just two days, tomorrow will be yesterday.

              J Offline
              J Offline
              JacquesDP
              wrote on last edited by
              #6

              I just had trouble to read the string from the file. I know its something like... System.Configuration.ConfigurationSettings.AppSettings but got the message that the ConfigurationSettings is absolute and is replaced by ConfigurationManager, but when I try to use it, it doesn't recognize ConfigurationManager So I just wondered in what type of event you will actually need a resources file? Thanks for the quick response

              He who laughs last is a bit on the slow side

              1 Reply Last reply
              0
              • J JacquesDP

                Ashvin Gunga wrote:

                Can you give additional information what you want to achieve?

                I learning myself C# and came across this, so there's nothing I want or need to do, just wondered how it worked and what it is for. The fact that you can load icons and images appealed to me because I didn't need to include them to the solution, just added them to the resource file and reference them from there. That's when I came across the strings you could save and wondered what type of string you would save in there

                He who laughs last is a bit on the slow side

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #7

                NeroToxic wrote:

                That's when I came across the strings you could save and wondered what type of string you would save in there

                Normally, you would use this to store localized versions of text. Instead of using the text "Hello" in your program, you would have a localized resource which contained the text and you would just use the resource instead. This means that you can create internationalized applications just by swapping resources.

                Deja View - the feeling that you've seen this post before.

                J Mike HankeyM 2 Replies Last reply
                0
                • P Pete OHanlon

                  NeroToxic wrote:

                  That's when I came across the strings you could save and wondered what type of string you would save in there

                  Normally, you would use this to store localized versions of text. Instead of using the text "Hello" in your program, you would have a localized resource which contained the text and you would just use the resource instead. This means that you can create internationalized applications just by swapping resources.

                  Deja View - the feeling that you've seen this post before.

                  J Offline
                  J Offline
                  JacquesDP
                  wrote on last edited by
                  #8

                  If I could I would have voted you 5 twice, that make sense, thanks.

                  He who laughs last is a bit on the slow side

                  P 1 Reply Last reply
                  0
                  • J JacquesDP

                    If I could I would have voted you 5 twice, that make sense, thanks.

                    He who laughs last is a bit on the slow side

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #9

                    No problem - only too glad to help.:-D

                    Deja View - the feeling that you've seen this post before.

                    1 Reply Last reply
                    0
                    • P Pete OHanlon

                      NeroToxic wrote:

                      That's when I came across the strings you could save and wondered what type of string you would save in there

                      Normally, you would use this to store localized versions of text. Instead of using the text "Hello" in your program, you would have a localized resource which contained the text and you would just use the resource instead. This means that you can create internationalized applications just by swapping resources.

                      Deja View - the feeling that you've seen this post before.

                      Mike HankeyM Offline
                      Mike HankeyM Offline
                      Mike Hankey
                      wrote on last edited by
                      #10

                      Hello my name is Mike. I was interested in your response and if you don't mind would like to ask an additional question?

                      Pete O`Hanlon wrote:

                      This means that you can create internationalized applications just by swapping resources.

                      Does this mean that to be able to use the resources you can swap them on the fly as opposed to re-building solution? Thanks, Mike

                      You can do anything you want but you pay for everything you do!

                      P 1 Reply Last reply
                      0
                      • Mike HankeyM Mike Hankey

                        Hello my name is Mike. I was interested in your response and if you don't mind would like to ask an additional question?

                        Pete O`Hanlon wrote:

                        This means that you can create internationalized applications just by swapping resources.

                        Does this mean that to be able to use the resources you can swap them on the fly as opposed to re-building solution? Thanks, Mike

                        You can do anything you want but you pay for everything you do!

                        P Offline
                        P Offline
                        Pete OHanlon
                        wrote on last edited by
                        #11

                        In a sense, yes. You create localized resource files and by dropping them into certain specially named folders, your application will be localized base on the relevant resource. For instance, if your culture is FR-Fr, then by dropping the localized version into the Fr-fr directory, you will see a localized French version.

                        Deja View - the feeling that you've seen this post before.

                        Mike HankeyM 1 Reply Last reply
                        0
                        • P Pete OHanlon

                          In a sense, yes. You create localized resource files and by dropping them into certain specially named folders, your application will be localized base on the relevant resource. For instance, if your culture is FR-Fr, then by dropping the localized version into the Fr-fr directory, you will see a localized French version.

                          Deja View - the feeling that you've seen this post before.

                          Mike HankeyM Offline
                          Mike HankeyM Offline
                          Mike Hankey
                          wrote on last edited by
                          #12

                          Thanks for the info was just curious. I thought maybe there was a way to dynamically load them. As an example (off the top of my head) if you had an app to teach a certain subject and you wanted to aim it towards different levels of audience you might have a beginners, inter. and pro and have resources for each. Thanks Mike

                          You can do anything you want but you pay for everything you do!

                          P 1 Reply Last reply
                          0
                          • Mike HankeyM Mike Hankey

                            Thanks for the info was just curious. I thought maybe there was a way to dynamically load them. As an example (off the top of my head) if you had an app to teach a certain subject and you wanted to aim it towards different levels of audience you might have a beginners, inter. and pro and have resources for each. Thanks Mike

                            You can do anything you want but you pay for everything you do!

                            P Offline
                            P Offline
                            Pete OHanlon
                            wrote on last edited by
                            #13

                            Well, you could do that with resources - it's certainly possible.

                            Deja View - the feeling that you've seen this post before.

                            Mike HankeyM 1 Reply Last reply
                            0
                            • P Pete OHanlon

                              Well, you could do that with resources - it's certainly possible.

                              Deja View - the feeling that you've seen this post before.

                              Mike HankeyM Offline
                              Mike HankeyM Offline
                              Mike Hankey
                              wrote on last edited by
                              #14

                              Where theres a will theres a way, always a work around. Thanks Mike

                              You can do anything you want but you pay for everything you do!

                              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