473,385 Members | 1,486 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,385 software developers and data experts.

saving user preferences

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 explanations
will be well appreciated...)

TIA,

- Tal
Feb 17 '07 #1
2 2921
On Sat, 17 Feb 2007 22:40:00 +0200, "Tal Shachar" <ta*********@hotmail.com>
wrote:
>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 explanations
will be well appreciated...)

TIA,

- Tal
Visual Studio is your friend...

In VS 2005, in the Help index search text box enter Application Settings. You
will be presented with a long list of topics.

Good luck with your project,

Otis Mukinfus

http://www.otismukinfus.com
http://www.arltex.com
http://www.tomchilders.com
http://www.n5ge.com
Feb 18 '07 #2
On Sun, 18 Feb 2007 10:31:40 +0800, Otis Mukinfus
<ph******************@phoney.comwrote:
On Sat, 17 Feb 2007 22:40:00 +0200, "Tal Shachar"
<ta*********@hotmail.com>
>[...]
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
[...]

Visual Studio is your friend...

In VS 2005, in the Help index search text box enter Application
Settings. You will be presented with a long list of topics.
The short answer is that you can add items to the project's "Settings".
You then access them from code using the Properties.Settings.Default
property. You can create default values in your project, retrieve and set
the values from code, and save them back out. .NET will deal with the
issues of where to actually store the settings and how to format the
storage file (it's an XML file, with individual settings generally being
stored as strings that are converted to and from the proper data types as
necessary).

I have found that just exploring the project and its settings in VS is
sufficient for learning the basic techniques, but if you still find
yourself lost, I agree with Otis that the help index can find you the
necessary articles in the .NET documentation.

Pete
Feb 27 '07 #3

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

Similar topics

7
by: Brian Wallis | last post by:
This may be a FAQ,but I cannot find it. I want to save user preferences, window sizes, recently opened file names, etc for a python application and I am looking for a package that does this in a...
0
by: Adam J. Schaff | last post by:
OK, there are billions of posts on dotnet newsgroups about this, and I have read half of them, but I'm still a little confused. First I'll say what I think I've learned and anyone can correct me if...
2
by: Nevyn Twyll | last post by:
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...
2
by: VS Noob | last post by:
Hello. I'm developing Windows.Forms based applications, and each will need per-user persistent data consisting of user preferences, last form size/position, and the like. Is there a standard or...
15
by: Dan DeConinck | last post by:
Hello, I want to save the position of all the controls on my form. I would like to write them out to a preference file. I have done this in DOS BASIC like this: TO WRITE the preference...
0
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences...
11
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences...
1
by: Tom | last post by:
I have a large application; lots of forms, multiple dynamic DLLs, etc. I also have, in the appliation, a general 'Preferences' class object (which is in itself a separate DLL, and I just include a...
1
by: sonic | last post by:
so, profile provider is a way to save application preferenes for each user. the profile can be replaced to provide a different persistance layer, and/or schema, but what about tweaking it to work...
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: 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:
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: 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
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...

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.