Dom said:
Hi Pete;
Can you tell me a little more about the "Settings" function? It seems
to be what I need. What class am I looking at?
All I find is System.XML.XMLDocument and a mess of methods and
properties.
Assuming you're using Visual Studio 2005:
In the Solution Explorer, under the project you'll find a Properties
section. Under that is a Settings item. Double-click that to add settings
to your project.
In code, you access the settings via Properties.Settings.Default (don't ask
my why you have to go through "Default"...I assume there's some good reason
related to other things you can do with Settings, but I haven't figured that
out yet
). Each setting shows up as a property under the Default
property and you can read and write to the settings just like any other
read/write property.
To make the settings persistent, just call
Properties.Settings.Default.Save() after you've changed them.
That's how you use it. What happens "behind the scenes" is that an XML file
is created under the user's "Documents and Settings" directory (XP, not sure
what happens in Vista but probably similar) in which all of those settings
are actually stored.
Note that the above is for settings with "Scope" of "User". If the "Scope"
is set to "Application", then the settings aren't maintained per-user, and
they aren't changeable by a user.
Pete