473,804 Members | 3,932 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Easily Saving user settings in a c# Windows Forms application

I understand that I am not supposed to alter the .config file for a program
(accessible through the AppSettings[]).

Is there a System class you could recommend that I could use (or even a
class out there somewhere) to easily load and save custom settings for the
current user? My only thought is to maybe use a datatable with "key" and
"value" columns and serialize it through XML in an IsolatedStorage File - but
this just seems so lame and inelegant.

Suggestions?

- Nevyn
Nov 15 '05 #1
2 2278
Hello,

"Nevyn Twyll" <as****@hotmail .com> schrieb:
I understand that I am not supposed to alter the .config file for a program (accessible through the AppSettings[]).

Is there a System class you could recommend that I could use (or even a
class out there somewhere) to easily load and save custom settings for the
current user? My only thought is to maybe use a datatable with "key" and
"value" columns and serialize it through XML in an IsolatedStorage File - but this just seems so lame and inelegant.


Application/user settings should not be saved into a config file:

http://www.palmbytes.de/content/dotn...optionslib.htm

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 15 '05 #2
"Gawelek" <ga*****@NOSPAM EKpoczta.gazeta .pl> wrote in message
news:bi******** **@atlantis.new s.tpi.pl...
Application/user settings should not be saved into a config file:


Why not ?

<snipped>

Gawel


Three reasons off the top of my head, with regard to user settings...

1) Application Upgrades. Do you really want to deal with maintaining user
settings when you push out version 1.1 of your application which includes an
updated app.config file?

2) Shared Systems. An application is typically installed only once
regardless of the number of people using the computer. If you store User A's
preferences in the app.config, User B will wind-up using the same settings
and have the ability to overwrite those settings with their own preferences.
You would essentially be able to store application preferences only - not
user preferences.

3) Security. In a properly secured system, the user is not running with
admin-level privileges and does not have permission to write to the file
system except to very specific places. An application's install folder is
not one of those specific places. This is one of the purposes of the
IsolatedStorage classes: writing to user-specific locations where you are
guaranteed they have the appropriate permissions.

Ryan LaNeve
Nov 15 '05 #3

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

Similar topics

138
6613
by: theodp | last post by:
--> From http://www.techdirt.com/articles/20040406/1349225.shtml Microsoft Patents Saving The Name Of A Game Contributed by Mike on Tuesday, April 6th, 2004 @ 01:49PM from the yeah,-that's-non-obvious dept. theodp writes "As if there weren't enough dodgy patents, here's an excerpt from one granted to Microsoft Tuesday for a 'Method and apparatus for displaying information regarding stored data in a gaming system': 'When saving a game,...
13
1917
by: Ron L | last post by:
I have an application we are building that will be used by a number of different users on shared PCs. I want to be able to store a number of user settings in a location that is unique for each user, so that one user's settings do not affect another. Is there a "standard" location to store these files? How about a "standard" location to store a file of default settings if the user hasn't run the application yet? TIA Ron L
3
3628
by: cdj | last post by:
Hi all, I've got a picturebox on a form, and a save button. When I go to save, the app craps out with the following error: ================== An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in system.drawing.dll
7
16521
by: Dennis C. Drumm | last post by:
Can my program access the HKEY_LOCAL_MACHINE/Software section of the registry when being used by a user with restricted rights (not with admin rights)? If so, how? I have a program that functions just fine when run by an administrator but generates an exception when run by a restricted user. The program accesses the HKEY_LOCAL_MACHINE/Software section to set or get application settings that are not user specific. Thanks,
8
8717
by: Henry Jones | last post by:
VB.NET Windows Forms VS 2005 I would like to give the user the option of changing the background color of the textbox to anything they want. Can someone provide code how to save the textbox1.BackColor to a string and then convert it back to a color that I can assign to the textbox? I have looked at colorconverter class which can inherit from the TypeConverter class and it's all too confusing. I tried some examples and just can't get...
2
2938
by: Tal Shachar | last post by:
Hi, I have a windows application that needs to save some user preferences to an xml and to load it on the next application run. Saving the preferences is done per user. I know that there is a way of saving it to some path under "Documents and Settings/UserName/...." , but I don't know the correct approach (e.g. path naming convention, how to preserve this per user, etc.) I can use all the assistance I can get (code snippets and some...
3
1777
by: Nathan Guill | last post by:
I have an interface that works with an Access back-end. I would like to store and/or load user defined query strings per each user (i.e. no user can access another's queries). The idea I had was a "table" stored with the C# front-end (not in the Access database), but don't know if this is even possible. If it is, can someone let me know how? Otherwise, how do other people handle storing and loading query strings for possible later use?
1
1341
by: romcab | last post by:
Hi guys, I would like to ask your help about saving in ado.net. I was able to update it only on the display but when I check the database, it is not updated. I paste below my code and hopefully you can help me. using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient;
1
4851
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 user settings? TIA, -- Terry
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10320
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.