maintain state of application for each user

S

Steve Richter

I would like store and recall user settings and window state for each
user of my application. By state I mean recalling at application
start the location in a list view the app was at the last time it
exited.

If I was maintaining this state regardless of user I would store it as
an xml document in the same directory as the program binary.

What is the windows standard way of storing user specific files of an
application? Can I create a shadow directory tree under the c:/users
directory that matches the directory path of the appl exe file?

thanks,

-Steve
 
M

Marina Levit [MVP]

Try creating the file in Application.UserAppDataPath directory. This is the
directory for each user where you can put stuff for your application. It is
automatically application specific (a subdirectory will be made for your
app).
 
L

Larry Smith

I would like store and recall user settings and window state for each
user of my application. By state I mean recalling at application
start the location in a list view the app was at the last time it
exited.

If I was maintaining this state regardless of user I would store it as
an xml document in the same directory as the program binary.

What is the windows standard way of storing user specific files of an
application? Can I create a shadow directory tree under the c:/users
directory that matches the directory path of the appl exe file?

What follows is probably the de facto way to do it now since it's integrated
right into VS. It's certainly the easiest and cleanest way I've discovered.
Also consult the "See Also" section at the bottom of the following link and
take a look at the "ApplicationSettingsBase" class which drives the entire
process (though you don't have to get your hands dirty with this too much
since VS automatically creates a strongly-typed "Settings" derivative for
you). You'll have to do a little research to figure things out of course but
the latter "Settings" class does most of the dirty work for you. It really
makes handling settings a breeze IMO.

http://msdn2.microsoft.com/en-us/library/25zf0ze8(VS.80).aspx
 

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