Best way to store user configuation

G

gordon

Hi

I am looking to store some details about a user's configuration choices, in
particular the place where they have installed some data files, the OS that
they use, and their Windows user name. This information is used in a
windows C#.net application.

I would like to capture this info the first time that the user opens the
app, but each subsequent time to make sure that the location is current when
they open the application. This is because the users may move items around
on their system and this may cause some oledb sql statements to fail.

Could you please suggest a design that you have used for this - i am
reluctant to write to the system registry as many users dont have local
admin rights to their PCs. I am thinking of the following pattern - but not
sure if it is the best one:

1. as part of the deployment, copy a config file to the same directory as
the application.
2. in that config file - set counter =0; user name =" ", OS="";
3. when the application is opened check to see if counter =0;
4. if counter is =0 then get the file location (from the OpenFileDialog and
the OS and user name and write to the config file;
5. populate the variables that require this information.
6. increment the counter;
7. close the file.
8. if counter >0 read the data in the config file and populate the variables
that need this information
9. increment the counter;
10 .close the file

If you see any major flaws in my logic or if you can suggest an alternative
(including the best way to store the information about the location, os and
username) please let me know.

Doug

What is the best way to store this information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top