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 in .NET 2.0

Settings in .NET 2.0

Scheduled Pinned Locked Moved C#
csharpxmlhelptutorial
7 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.
  • J Offline
    J Offline
    Jan Hirak
    wrote on last edited by
    #1

    Hi, when I create some user scope or application scope settings in assembley which is used as windows library, xml document with settings is generated but I`m not sure what to do after that. Because application uses only default settings which where generated to properity class. When I change any setting in that xml file,they are ignored and app still uses its default values. Can anybody either help me, or point me to some article explaining how to set up windows library settings. Thank you

    N 1 Reply Last reply
    0
    • J Jan Hirak

      Hi, when I create some user scope or application scope settings in assembley which is used as windows library, xml document with settings is generated but I`m not sure what to do after that. Because application uses only default settings which where generated to properity class. When I change any setting in that xml file,they are ignored and app still uses its default values. Can anybody either help me, or point me to some article explaining how to set up windows library settings. Thank you

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      The settings are in the app.config file? You have setup the databinding for these controls correct? Do you want the changes to show up as they are changed or when the app restarts?

      J 1 Reply Last reply
      0
      • N Not Active

        The settings are in the app.config file? You have setup the databinding for these controls correct? Do you want the changes to show up as they are changed or when the app restarts?

        J Offline
        J Offline
        Jan Hirak
        wrote on last edited by
        #3

        App.config is generated for .exe file but what about if I create class library and reference it. Shoud I manualy copy settings for class library to app.config or is there any other way. I dont realy understand the point of settings designer for class library if those settings are not generated.

        N 1 Reply Last reply
        0
        • J Jan Hirak

          App.config is generated for .exe file but what about if I create class library and reference it. Shoud I manualy copy settings for class library to app.config or is there any other way. I dont realy understand the point of settings designer for class library if those settings are not generated.

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          You can add an app.config to your library project. This will produce, as an example, mylib.dll.config. If your library has Windows controls though any settings would be stored in the app.config when you bind the control to the application settings. I guess I'm not sure what is your having difficulties with.

          J 1 Reply Last reply
          0
          • N Not Active

            You can add an app.config to your library project. This will produce, as an example, mylib.dll.config. If your library has Windows controls though any settings would be stored in the app.config when you bind the control to the application settings. I guess I'm not sure what is your having difficulties with.

            J Offline
            J Offline
            Jan Hirak
            wrote on last edited by
            #5

            I try to explain my problem. I add, say, string testString whith default value "abcd" in settings designer of class library test.dll. The string is accesible over Properities.Settings class. It has its default value "abcd" which is generated as an atribute and compiled into library. Now the libary generates test.dll.config file and it includes the testString element. When I copy this test.dll.config to application directory with my class library and change value of testString element to "dcba" and restart application it still uses its default value "abcd". And although that Properties.Settings.testString property is writtable, when I change its value in program and call Save (or there is something like that)on Properties class it will not save it to the test.dll.config. Should this be working and there is some other mistake I'm doing or is this procedure wrong. Thank you

            N 1 Reply Last reply
            0
            • J Jan Hirak

              I try to explain my problem. I add, say, string testString whith default value "abcd" in settings designer of class library test.dll. The string is accesible over Properities.Settings class. It has its default value "abcd" which is generated as an atribute and compiled into library. Now the libary generates test.dll.config file and it includes the testString element. When I copy this test.dll.config to application directory with my class library and change value of testString element to "dcba" and restart application it still uses its default value "abcd". And although that Properties.Settings.testString property is writtable, when I change its value in program and call Save (or there is something like that)on Properties class it will not save it to the test.dll.config. Should this be working and there is some other mistake I'm doing or is this procedure wrong. Thank you

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              Ok I understand now. I made a test library with a user control containing a label, textbox and button. Everything seems fine to me. private void button1_Click(object sender, EventArgs e) { global::LibControls.Properties.Settings.Default.LabelText = textBox1.Text; global::LibControls.Properties.Settings.Default.Save(); global::LibControls.Properties.Settings.Default.Reload(); }

              J 1 Reply Last reply
              0
              • N Not Active

                Ok I understand now. I made a test library with a user control containing a label, textbox and button. Everything seems fine to me. private void button1_Click(object sender, EventArgs e) { global::LibControls.Properties.Settings.Default.LabelText = textBox1.Text; global::LibControls.Properties.Settings.Default.Save(); global::LibControls.Properties.Settings.Default.Reload(); }

                J Offline
                J Offline
                Jan Hirak
                wrote on last edited by
                #7

                Ok, I will try to find out what I'm doing wrong. Thanks for help

                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