Settings don't persist

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I was dissapointed to see that the new Settings system in 2005 doesn't
appear to persist the data between application sessions. I understand that
it is used for application initialization, but there is something I read
that made me think it would work for user settings as well. Is there an
option I need to switch somewhere to get these to persist or is it back to
serializing my own options class to XML?

Thanks,
Steve
 
Somewhere in your code you have to call the Save() method... e.g.
Preferences.Default.Save();

HTH
Mark
 
StealthyMark said:
Somewhere in your code you have to call the Save() method... e.g.
Preferences.Default.Save();

That is exactly what I was looking for, thank you! Weird this is, the docs
say that it will create a AppName.exe.config file to hold the settings (if
using the default provider) and it also says this file will be created in
teh same located as the executable that created it. Weird thing is... I
don't have that file! But the settings are saved.... so weird. A google
desktop search didn't find it either, so I don't know where that file is.

Anyway, thanks again for the post,
Steve
 
That is exactly what I was looking for, thank you! Weird this is, the docs
say that it will create a AppName.exe.config file to hold the settings (if
using the default provider) and it also says this file will be created in
teh same located as the executable that created it. Weird thing is... I
don't have that file! But the settings are saved.... so weird. A google
desktop search didn't find it either, so I don't know where that file is.

I don't know how the 2005 settings system works but i would suppose that
the settings file is actually created in the user IsolatedStoarage for the
application. It would not make any sense to me to store user settings
beside the executable since users are often not allowed to write in this
folder.
 
Well, the *initial* (default) settings *are* read from the config file, but
afterwards the settings are persisted to either of three locations, depending
on the properties of the specific setting.
You can set the scope to User or Application, and there is an
SettingsManageability attribute, which controls whether the setting is stored
in the domain profile for the user. It cannot be set using the designer(?).

Mark
 
Hi Mark,

I will look into the SettingsManageability attribute. I'm not sure what a
"domain profile" is, but I will learn.

Thanks for the information.
Have a great weekend!
Steve
 
Back
Top