473,411 Members | 2,085 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,411 software developers and data experts.

Can app.config be updated by the user?

I store several application settings in the project's "app.config" file. I
also have a form that reads these values and displays them in a listview so
that the user can adjust them. My question is: can the changes made by the
user to the settings values be saved back to "app.config" so that when the
application is launched tomorrow, the updated values are used?

Since the original app.config settings are loaded to
"projectName.exe.config", and updated there by the user, another way of
asking the same question is: how to write the values in
"projectName.exe.config" back to "app.config"?

Thanks,
Dean Slindee
Nov 21 '05 #1
5 3417
"Dean Slindee" <sl*****@charter.net> wrote in
news:10*************@corp.supernews.com:
My question is: can the changes made by the
user to the settings values be saved back to "app.config" so that when
the application is launched tomorrow, the updated values are used?


No, the config files are read only, You'll need to write your own XML
classes to update the configs.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #2
Microsoft 'prefers' that the app.config file be considered a read-only
application initialization repository. For one thing, since there's only one
file for the application it's machine-wide rather than user-specific. Thus
it's not a good place for user-specific preferences. Probably the best place
to store user preferences is in your own XML files, either in user-specific
isolated storage, or in the directory represented by
Application.UserAppDataPath.

Quite a few people, by now, have created libraries for managing user
preferences in XML files (I've certainly done it for my own personal use).
It's a shame that MS didn't supply wrapper classes for this in the
framework, since we're all having to re-invent the wheel on this. If you
look around places like www.gotdotnet.com or www.sourceforge.net you'll
undoubtedly come across one or more solutions to this problem that have been
contributed by that community. I haven't contributed my own, since I doubt
that the world needs another one.

Tom Dacon
Dacon Software Consulting

"Dean Slindee" <sl*****@charter.net> wrote in message
news:10*************@corp.supernews.com...
I store several application settings in the project's "app.config" file. I also have a form that reads these values and displays them in a listview so that the user can adjust them. My question is: can the changes made by the user to the settings values be saved back to "app.config" so that when the
application is launched tomorrow, the updated values are used?

Since the original app.config settings are loaded to
"projectName.exe.config", and updated there by the user, another way of
asking the same question is: how to write the values in
"projectName.exe.config" back to "app.config"?

Thanks,
Dean Slindee

Nov 21 '05 #3
I should also add, as a disadvantage of trying to write into the app.config
file, that you can't guarantee that the user of the application will have
write permissions on the directory in which the application executable and
the config file reside. A system administrator might lock that directory
down, causing your application to fail with a permissions exception when you
tried to write to the file.

Tom Dacon

"Tom Dacon" <td****@community.nospam> wrote in message
news:uP*************@TK2MSFTNGP12.phx.gbl...
Microsoft 'prefers' that the app.config file be considered a read-only
application initialization repository. For one thing, since there's only one file for the application it's machine-wide rather than user-specific. Thus
it's not a good place for user-specific preferences. Probably the best place to store user preferences is in your own XML files, either in user-specific isolated storage, or in the directory represented by
Application.UserAppDataPath.

Quite a few people, by now, have created libraries for managing user
preferences in XML files (I've certainly done it for my own personal use).
It's a shame that MS didn't supply wrapper classes for this in the
framework, since we're all having to re-invent the wheel on this. If you
look around places like www.gotdotnet.com or www.sourceforge.net you'll
undoubtedly come across one or more solutions to this problem that have been contributed by that community. I haven't contributed my own, since I doubt
that the world needs another one.

Tom Dacon
Dacon Software Consulting

"Dean Slindee" <sl*****@charter.net> wrote in message
news:10*************@corp.supernews.com...
I store several application settings in the project's "app.config" file.

I
also have a form that reads these values and displays them in a listview

so
that the user can adjust them. My question is: can the changes made by

the
user to the settings values be saved back to "app.config" so that when the application is launched tomorrow, the updated values are used?

Since the original app.config settings are loaded to
"projectName.exe.config", and updated there by the user, another way of
asking the same question is: how to write the values in
"projectName.exe.config" back to "app.config"?

Thanks,
Dean Slindee


Nov 21 '05 #4
TO write settings via an xml file:

http://www.kjmsolutions.com/xmlsettings.htm

To write settings to an app.config file....(not recommended)

http://www.kjmsolutions.com/download...onfigstuff.ZIP

to use Isolated storage..(must have adequate .NET permissions..)

http://www.kjmsolutions.com/download...igsystemio.ZIP

________________________________

From: Dean Slindee [mailto:sl*****@charter.net]
Sent: Saturday, August 21, 2004 11:20 PM
To: microsoft.public.dotnet.languages.vb
Subject: Can app.config be updated by the user?

I store several application settings in the project's "app.config" file.
I
also have a form that reads these values and displays them in a listview
so
that the user can adjust them. My question is: can the changes made by
the
user to the settings values be saved back to "app.config" so that when
the
application is launched tomorrow, the updated values are used?

Since the original app.config settings are loaded to
"projectName.exe.config", and updated there by the user, another way of
asking the same question is: how to write the values in
"projectName.exe.config" back to "app.config"?

Thanks,
Dean Slindee
Nov 21 '05 #5
No but see this other app settings class:
http://www.west-wind.com/presentatio...ationclass.asp

--

HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Concept S2i inc.(www.s2i.com)
"Dean Slindee" <sl*****@charter.net> wrote in message
news:10*************@corp.supernews.com...
I store several application settings in the project's "app.config" file. I also have a form that reads these values and displays them in a listview so that the user can adjust them. My question is: can the changes made by the user to the settings values be saved back to "app.config" so that when the
application is launched tomorrow, the updated values are used?

Since the original app.config settings are loaded to
"projectName.exe.config", and updated there by the user, another way of
asking the same question is: how to write the values in
"projectName.exe.config" back to "app.config"?

Thanks,
Dean Slindee

Nov 21 '05 #6

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

Similar topics

7
by: Todd Beaulieu | last post by:
Hello, I'm using the configuration block to store user settings in the app.config file. As this exe will reside on a network drive, I can't have users trying to update the master app.config...
2
by: Ellis Yu | last post by:
Dear All, I use function configurationsettings.appsetting to retrieve the connection string value which stored in a file app.config. At the beginning, it's fine that it can pick up the value...
1
by: MrXs | last post by:
i have a setting form for my program and wish to allow the setting to be saved and reopened to the last set setting on program startup.. lets say i have a xml file like this : <?xml...
8
by: Robert | last post by:
I have what I think should be a pretty common scenario in a corporate environment. I have a web app and three environments on three servers: Development, QA and Production. We develop in...
0
by: amperie | last post by:
Hey experts, I have a vb.net (2.0) application that is basically a scheduling application. It wakes up periodically, checks to see if there's tasks to be ran and kicks off any tasks in another...
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...
3
by: Piotrekk | last post by:
Hi I have a problem connected with user.config file. I am using default settings.settings . To settings.settings I am adding one user scope string and one application scope string. Thus...
1
by: =?Utf-8?B?VGVycnk=?= | last post by:
I am using the My.Settings object to save user settings. During testing, I want to 'zero' out what has been saved to start with the defaults again. Where doies the framwork actually persist these...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.