473,378 Members | 1,119 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Writing to a configuration file

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
3 1561
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: msnews.microsoft.com | last post by:
Hi all, I was trying to find an easy way to write in the standard configuration (like app.config) xml-based files. I found classes that can be used to read this information (in...
2
by: Job Lot | last post by:
I am trying to write value for a key in <appSettings><add key="LidbsdPath" value="" /></appSettings> section of config file from vb.net app, using statement below ...
7
by: Daniel Moree | last post by:
I'm working on a program that must first establish if the file exists in the program directory then it must open if for reading, read each line and set the variables then the program goes on about...
16
by: Frank Oquendo | last post by:
ConfigurationSettings.AppSettings allows me to read from my config but how do I write to my config file? -- There are 10 kinds of people. Those who understand binary and those who don't. ...
19
by: Noozer | last post by:
I need to keep my application settings in a file that users can copy/backup/etc. Before I start using the old INI file standard, is there any easy way to use XML files to hold application...
9
by: Julien Biezemans | last post by:
Hi! Here is the problem: I'd like to restrict local filesystem stream operations to one directory just like a root jail. fopen('/file.bin') would actually open /some/path/file.bin. One goal...
3
by: Eric | last post by:
Help! I created a XML schema with a Visual Studio tools. I'm filling a dataset with a DataAdapter. Before I use the "WriteXml" method to write the data to a xml file, I want to map the XSD file I...
6
by: Peted | last post by:
Hi, im wanting to store some custom text strings in the app.config file of a c# app, to be retreived and updated when the app runs. using c# 2005 express in my testing i am using the code...
0
by: =?Utf-8?B?QWxleA==?= | last post by:
Hi all! At the moment, I am transfering an application from Windows XP to Vista. As I would like to make the application compliant with Vista, I am having some questions: 1. ) A part of the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.