471,610 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,610 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 2813
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Brian Wallis | last post: by
reply views Thread by Adam J. Schaff | last post: by
2 posts views Thread by VS Noob | last post: by
reply views Thread by Tom | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by CCCYYYY | last post: by

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.