By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,567 Members | 1,609 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,567 IT Pros & Developers. It's quick & easy.

Writing to a configuration file

P: n/a
I know how to read from an application configuration file, by using
System.Configuration.AppSettingsReader.
This object does not allow writing a value back though. Does anybody
know how to do this?

The application is Windows Forms.


Thanks.

FireStarter.
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Load the file into an XmlDocument and make the changes, then save the
changes.

"FireStarter" <d@d.com> wrote in message
news:OA**************@TK2MSFTNGP15.phx.gbl...
I know how to read from an application configuration file, by using
System.Configuration.AppSettingsReader.
This object does not allow writing a value back though. Does anybody
know how to do this?

The application is Windows Forms.


Thanks.

FireStarter.

Nov 16 '05 #2

P: n/a
Thank you, Peter. I just thought that the framework would provide a
wrapper class for writing, since it provides one for reading.
An AppSettings class with two main methods, .Read(string key) and
..Write(string key, string value) would have made sense, if you ask me.

Well, I'll just have to write my own :)
Thanks again.

Peter Rilling wrote:
Load the file into an XmlDocument and make the changes, then save the
changes.

"FireStarter" <d@d.com> wrote in message
news:OA**************@TK2MSFTNGP15.phx.gbl...
I know how to read from an application configuration file, by using
System.Configuration.AppSettingsReader.
This object does not allow writing a value back though. Does anybody
know how to do this?

The application is Windows Forms.


Thanks.

FireStarter.


Nov 16 '05 #3

P: n/a
A Microsoft group just released a never version of the application blocks,
called enterprise blocks:
http://msdn.microsoft.com/library/de...tml/entlib.asp

If you are not opposed to using them (bit of a learning curve) you can get a
patch and new extensions from:
http://www.gotdotnet.com/workspaces/...2-91be63527327

One of the extensions is to read/write to your app config.

--
Thanks
Wayne Sepega
Jacksonville, Fl
"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

"FireStarter" <d@d.com> wrote in message
news:ut**************@TK2MSFTNGP14.phx.gbl...
Thank you, Peter. I just thought that the framework would provide a
wrapper class for writing, since it provides one for reading.
An AppSettings class with two main methods, .Read(string key) and
.Write(string key, string value) would have made sense, if you ask me.

Well, I'll just have to write my own :)
Thanks again.

Peter Rilling wrote:
Load the file into an XmlDocument and make the changes, then save the
changes.

"FireStarter" <d@d.com> wrote in message
news:OA**************@TK2MSFTNGP15.phx.gbl...
I know how to read from an application configuration file, by using
System.Configuration.AppSettingsReader.
This object does not allow writing a value back though. Does anybody
know how to do this?

The application is Windows Forms.


Thanks.

FireStarter.


Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.