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. settings.settings property is read-only?

settings.settings property is read-only?

Scheduled Pinned Locked Moved C#
csharpvisual-studiocomhelpquestion
7 Posts 4 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.
  • R Offline
    R Offline
    rfresh
    wrote on last edited by
    #1

    I'm trying to save one of my settings.settings fields when I close my VS 2012 C# app but I'm getting an error saying this is a read-only property. Where so I change it to read/write? Thanks...

        private void FormMain\_FormClosing(object sender, FormClosingEventArgs e)
        {
            Properties.Settings.Default.emailAddress = "someone@isp.com";
        }
    
    B 1 Reply Last reply
    0
    • R rfresh

      I'm trying to save one of my settings.settings fields when I close my VS 2012 C# app but I'm getting an error saying this is a read-only property. Where so I change it to read/write? Thanks...

          private void FormMain\_FormClosing(object sender, FormClosingEventArgs e)
          {
              Properties.Settings.Default.emailAddress = "someone@isp.com";
          }
      
      B Offline
      B Offline
      BillWoodruff
      wrote on last edited by
      #2

      If your setting is a User Setting, you need to save all the current User Settings to make them persist between Application use; if your Setting is an Application Level Setting, you cannot change it at run-time. In the Visual Studio Settings Designer you can change the scope of a Setting to 'User.

      Properties.Settings.Default.Save();

      Quote:

      Settings that are application-scoped are read-only, and can only be changed at design time or by altering the .config file in between application sessions. Settings that are user-scoped, however, can be written at run time just as you would change any property value. The new value persists for the duration of the application session. You can persist the changes to the settings between application sessions by calling the Save method. [^]

      I found the information here useful: [^].

      ~ “This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal

      R 2 Replies Last reply
      0
      • B BillWoodruff

        If your setting is a User Setting, you need to save all the current User Settings to make them persist between Application use; if your Setting is an Application Level Setting, you cannot change it at run-time. In the Visual Studio Settings Designer you can change the scope of a Setting to 'User.

        Properties.Settings.Default.Save();

        Quote:

        Settings that are application-scoped are read-only, and can only be changed at design time or by altering the .config file in between application sessions. Settings that are user-scoped, however, can be written at run time just as you would change any property value. The new value persists for the duration of the application session. You can persist the changes to the settings between application sessions by calling the Save method. [^]

        I found the information here useful: [^].

        ~ “This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal

        R Offline
        R Offline
        rfresh
        wrote on last edited by
        #3

        Ahhhh...yes, the difference (for me) was that I had some items set to Application and thus they were read-only. I changed them to User and can now save their data. Thanks Bill.

        1 Reply Last reply
        0
        • B BillWoodruff

          If your setting is a User Setting, you need to save all the current User Settings to make them persist between Application use; if your Setting is an Application Level Setting, you cannot change it at run-time. In the Visual Studio Settings Designer you can change the scope of a Setting to 'User.

          Properties.Settings.Default.Save();

          Quote:

          Settings that are application-scoped are read-only, and can only be changed at design time or by altering the .config file in between application sessions. Settings that are user-scoped, however, can be written at run time just as you would change any property value. The new value persists for the duration of the application session. You can persist the changes to the settings between application sessions by calling the Save method. [^]

          I found the information here useful: [^].

          ~ “This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal

          R Offline
          R Offline
          rfresh
          wrote on last edited by
          #4

          Bill, this is the oddest site to find things, you mention before to delete a message and repost it but there was no way to delete. Now you're suggesting I vote a thank you which I 100% agree with but I don't see anything regarding voting. Strangest site!

          R 1 Reply Last reply
          0
          • R rfresh

            Bill, this is the oddest site to find things, you mention before to delete a message and repost it but there was no way to delete. Now you're suggesting I vote a thank you which I 100% agree with but I don't see anything regarding voting. Strangest site!

            R Offline
            R Offline
            Ron Beyer
            wrote on last edited by
            #5

            There are little red (down vote) and green (up vote) arrows to the left of the message you want to vote on. Just open the message and move your mouse towards the left side under the document icon and it'll show the voting arrows. At the bottom of your messages are the links to edit/delete, etc. You can use those too.

            R 1 Reply Last reply
            0
            • R Ron Beyer

              There are little red (down vote) and green (up vote) arrows to the left of the message you want to vote on. Just open the message and move your mouse towards the left side under the document icon and it'll show the voting arrows. At the bottom of your messages are the links to edit/delete, etc. You can use those too.

              R Offline
              R Offline
              rfresh
              wrote on last edited by
              #6

              Yep, I went to look again and finally figured that out!!! Up vote to you Bill...!!

              L 1 Reply Last reply
              0
              • R rfresh

                Yep, I went to look again and finally figured that out!!! Up vote to you Bill...!!

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                rfresh wrote:

                Up vote to you Bill..

                But you still have not upvoted his message.

                Use the best guess

                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