Should i create my own xml files and save it in
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
?
What about the Settings class.? There were examples in vb.net which
lets a user save.
If it is readonly then why is there a save method?
The .NET 2.0 settings classes are pretty good for many uses.
> Should i create my own xml files and save it in
> Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
> ?
I wouldn't if I were you.
> What about the Settings class.? There were examples in vb.net which
> lets a user save.
>
> If it is readonly then why is there a save method?
Calling Save() is fine - but it will only save the user settings, not
application settings.
The previously saved settings will be loaded by default next time
they're accessed, assuming you use the auto-generated class
(Settings.settings etc in Visual Studio).
Jon
Yes I am using the Settings.settings file
So if dont write my own xml files how will i save application
settings?
Application settings aren't meant to be changed out in the wild. It's
more of a way for you to store settings instead of hard coding
values.
<snip>
> Yes I am using the Settings.settings file
>
> So if dont write my own xml files how will i save application
> settings?
Do they *have* to be application settings rather than user settings? I
don't know offhand of any easy way of saving application settings,
although there may well be a way somewhere.
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Thats what i thought.. I have used web.config in asp.net applications
for storing read only appplication configuration stuff..
So I will either have to write my custom xml or save to DB???
<snip>
> > Application settings aren't meant to be changed out in the wild. It's
> > more of a way for you to store settings instead of hard coding
> > values.
>
> Thats what i thought.. I have used web.config in asp.net applications
> for storing read only appplication configuration stuff..
>
> So I will either have to write my custom xml or save to DB???
Well, the settings mechanism is reasonably extensible - you may find
there's already code you can take.
However, you should ask yourself what distinction you want to draw
between user and application settings beyond the fact that one set is
writable and the other isn't. What harm would it do to make all the
settings user settings?
I think you misunderstand... Settings can be either Application (which
aren't meant to be changed) or User (which can be saved as described
in this thread). If you want the user to be able to change settings,
either diretly or indirectly, you should set them as user settings.
yea.. i can think in that direction.. thansk..
I'm curious as to why you wouldn't recommend this?
--
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space program."
-- Larry Niven
Because using the built-in classes is so much easier.
I agree with Jon, for this case are user settings the best solution.
The article http://www.codeproject.com/KB/dotnet/user_settings.aspx
describes the pros.
Jani