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. Visual Basic
  4. System.Configuration Namespace

System.Configuration Namespace

Scheduled Pinned Locked Moved Visual Basic
questionworkspace
9 Posts 3 Posters 1 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.
  • B Offline
    B Offline
    beowulfagate
    wrote on last edited by
    #1

    Is there a way me to use the classes in System.Configuration in a read/write way. I've looked through the examples and documentation ant it seems that it only supports read-only use. I would like to use this functionality in a Options form that would read and save the configurations for my application. Any Ideas? Is there a write-able equivalent to the AppSettingsReader Class?

    T D 2 Replies Last reply
    0
    • B beowulfagate

      Is there a way me to use the classes in System.Configuration in a read/write way. I've looked through the examples and documentation ant it seems that it only supports read-only use. I would like to use this functionality in a Options form that would read and save the configurations for my application. Any Ideas? Is there a write-able equivalent to the AppSettingsReader Class?

      T Offline
      T Offline
      tanstaafl28
      wrote on last edited by
      #2

      Off the top of my head, I would think it dangerous to allow a system namespace to be read/write, but I'm pretty new to this myself. This does not keep you from creating your own class though. Still coaxing software out of the can after all these years...

      B 1 Reply Last reply
      0
      • T tanstaafl28

        Off the top of my head, I would think it dangerous to allow a system namespace to be read/write, but I'm pretty new to this myself. This does not keep you from creating your own class though. Still coaxing software out of the can after all these years...

        B Offline
        B Offline
        beowulfagate
        wrote on last edited by
        #3

        Yeah, thought so. I am creating a class using xml though. Thanks.

        1 Reply Last reply
        0
        • B beowulfagate

          Is there a way me to use the classes in System.Configuration in a read/write way. I've looked through the examples and documentation ant it seems that it only supports read-only use. I would like to use this functionality in a Options form that would read and save the configurations for my application. Any Ideas? Is there a write-able equivalent to the AppSettingsReader Class?

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          No, you can't use the Configuration class as Writable. But, you can write out the Properties and such using XML. For an example of this, check out this article, Creating Your Own Dynamic Properties and Preserve Property Settings in Visual Basic .NET [^], on MSDN. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          B 2 Replies Last reply
          0
          • D Dave Kreskowiak

            No, you can't use the Configuration class as Writable. But, you can write out the Properties and such using XML. For an example of this, check out this article, Creating Your Own Dynamic Properties and Preserve Property Settings in Visual Basic .NET [^], on MSDN. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            B Offline
            B Offline
            beowulfagate
            wrote on last edited by
            #5

            Great article! Though for my purposes I think it would be better if I create my own class to write dynamic properties. I was hoping to add a feature that will allow addition of new configuration sections and additional attributes. Thanks a lot!!

            1 Reply Last reply
            0
            • D Dave Kreskowiak

              No, you can't use the Configuration class as Writable. But, you can write out the Properties and such using XML. For an example of this, check out this article, Creating Your Own Dynamic Properties and Preserve Property Settings in Visual Basic .NET [^], on MSDN. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

              B Offline
              B Offline
              beowulfagate
              wrote on last edited by
              #6

              How do I access a custom section in a custom section group? I was hoping to have something like this:

              D 1 Reply Last reply
              0
              • B beowulfagate

                How do I access a custom section in a custom section group? I was hoping to have something like this:

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                Like what? Make sure you use the < and > buttons at the botrom of the message box when you post here. Anything in < > characters will be treated like HTML tags and not displayed. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                B 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  Like what? Make sure you use the < and > buttons at the botrom of the message box when you post here. Anything in < > characters will be treated like HTML tags and not displayed. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                  B Offline
                  B Offline
                  beowulfagate
                  wrote on last edited by
                  #8

                  Ok. Sorry about that. After doing some research I got what I wanted. Related question: Can I have multiple sections in a sectionGroup? Like this? <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="CustomSectionGroup"> <section name="CustomSection" type="System.Configuration.SingleTagSectionHandler" /> <section name="CustomSection2" type="System.Configuration.NameValueSection" /> </sectionGroup> </configSections> <CustomSectionGroup> <CustomSection setting1="value1" setting2="value2" /> <CustomSection2> <add key="key1" value="value1"> <add key="key2" value="value2"> </ CustomSection2> </CustomSectionGroup> </configuration>

                  D 1 Reply Last reply
                  0
                  • B beowulfagate

                    Ok. Sorry about that. After doing some research I got what I wanted. Related question: Can I have multiple sections in a sectionGroup? Like this? <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="CustomSectionGroup"> <section name="CustomSection" type="System.Configuration.SingleTagSectionHandler" /> <section name="CustomSection2" type="System.Configuration.NameValueSection" /> </sectionGroup> </configSections> <CustomSectionGroup> <CustomSection setting1="value1" setting2="value2" /> <CustomSection2> <add key="key1" value="value1"> <add key="key2" value="value2"> </ CustomSection2> </CustomSectionGroup> </configuration>

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    Yes, you can. You have to use ConfigurationSettings.GetConfig() to access a custom configuration section. You might want to look at this[^] on MSDN for an example and what the limitions are. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                    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