System.Configuration Namespace
-
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?
-
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?
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...
-
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...
Yeah, thought so. I am creating a class using xml though. Thanks.
-
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?
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
-
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
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!!
-
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
How do I access a custom section in a custom section group? I was hoping to have something like this:
-
How do I access a custom section in a custom section group? I was hoping to have something like this:
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
-
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
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>
-
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>