473,386 Members | 1,763 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,386 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 6697
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.