472,799 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

where to save app settings?

It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam
Jul 21 '05 #1
5 6656
Hi Sam,

Using .config files is the popular way of storing configuration infomation.

Note that the .config file of an app is read only the first time it is
loaded - any further changes you make to the .config file will not be
reflected in the app, and therefore, will be read only on read in the next
run of the app.

Also check out:
http://www.grimes.demon.co.uk/dotnet/configFAQ.htm

HTH,
Rakesh Rajan

"Sam Carleton" wrote:
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam

Jul 21 '05 #2
Hi,

Link to MSDN article on appSettings section
http://msdn.microsoft.com/library/de...ngssection.asp

HTH,
Rakesh Rajan

"Rakesh Rajan" wrote:
Hi Sam,

Using .config files is the popular way of storing configuration infomation.

Note that the .config file of an app is read only the first time it is
loaded - any further changes you make to the .config file will not be
reflected in the app, and therefore, will be read only on read in the next
run of the app.

Also check out:
http://www.grimes.demon.co.uk/dotnet/configFAQ.htm

HTH,
Rakesh Rajan

"Sam Carleton" wrote:
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam

Jul 21 '05 #3
The .config file is the prefered place to store application settings.
However, they should not be changed by the application.

User configured settings should be saved to the user's folder (use
Environment.SpecialFolder.ApplicationData or
Environment.SpecialFolder.LocalApplicationData) - NOT the application
folder, where the .config file is.
A simple way to store user settings is create a class to hold all of
your settings and the serialize it to an XML file in the special folder.
You then de-serialize the file to restore the settings.
Sam Carleton wrote:
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam

Jul 21 '05 #4
"Sam Carleton" <sc**************@miltonstreet.com> wrote in message
news:LS****************@tornado.ohiordc.rr.com...
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.


The .config file is for application settings, not user settings. For user
settings, you probably want to save the data in "Isolated Storage". You can
go to www.genghisgroup.com where you will find a free set of tools that
includes a Preferences class that saves user preferences in Isolated
Storage.
Jul 21 '05 #5
See the Enterprise Library, a seperate download from MS
http://msdn.microsoft.com/library/de...tml/entlib.asp

The configuration application block will allow you to read and write
configuration settings. Even though the design of this AB is highly
flexible and extensible, you do not need to create new storage provider to
use the XML config files.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Sam Carleton" <sc**************@miltonstreet.com> wrote in message
news:LS****************@tornado.ohiordc.rr.com...
It is my understanding that in .Net the registry is not the
prefered place to save application settings. What has Microsoft
put in place to replace it? I thought it was the .config file,
but I am unable to figure out how to write to the file.

Sam

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sam Carleton | last post by:
It is my understanding that in .Net the registry is not the prefered place to save application settings. What has Microsoft put in place to replace it? I thought it was the .config file, but I...
0
by: ssg31415926 | last post by:
I've been trying to save a hashtable in an Application Settings file. I need to save settings for each tabPage on a form. Trouble is, the number of tabPages is determined at runtime, so I can't...
10
by: Paul Cheetham | last post by:
Hi, I am developing an application that needs to store some machine-specific settings. The application is going to be published on the network in order to keep the clients on the latest version....
2
by: John | last post by:
I have a Win app in C#. I want to save the data the user enterere into textboxes and the selections the user made to comboboxes when the user close the app. So next time when the user launches the...
4
by: Dave | last post by:
I have some data values that will will rarely change over the life of the program. I don't think it is wise to save it in a database. Is it ok to save them in Properties.Settings if I have many...
4
by: Richard Lewis Haggard | last post by:
I have an application that can't use the registry to save various user options and application settings. My first thought was to simply use an application configuration file but this approach seems...
4
by: Ronald S. Cook | last post by:
I want to maintain a list of value/pairs in my Windows application. Where is the best way to store this? Do I want to use Application Settings and have a row for each value pair? There will be...
1
by: raz230 | last post by:
I have a vb.net project. I am using app.config to store some data that I want the user to be able to change. I do this: My.Settings.Host = txtURL.text.trim My.Settings.Save My.Settings.Reload...
3
by: Scott M. | last post by:
If I add a setting to my project in the settings designer and mark it as a user setting, and then access and modify the setting via code, where is the updated setting stored so that it won't be...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.