With SettingsXpress you can easily create an XML settings file for your application, to store and retrieve application
settings, using a streamlined code interface.
SettingsXpress can store and retrieve all native CLS compliant DotNet data types as well as
settings without the need to parse string values.
SettingsFile class acts as a virtual storage facility for your application
and component settings. The settings file is organized in a hierarchical format, based on a logical ordering of
SettingsKeys stored within it.
By default the settings file is stored in the current users AppData folder for the current client
application. You can also specify a custom location and filename for the settings file using the
SettingsKey is the base unit of organization in the settings file, and can be compared to a folder.
A particular key can have subkeys (just as a folder can have subfolders)
SettingsKey can have multiple settings stored within it. Each setting holds one particular value,
which can be retrieved or updated when required.
Creating SettingsKeys and storing settings
To use your application settings file, you start by accessing the static
Settings property of the
SettingsFile class, which returns the root
SettingsKey in the settings file.
To create a subkey use the
CreateSubKey method. Once a
established you can now store settings using the
SettingsKey dataSettings = SettingsFile.Settings.
Note: When you first access the settings file in your code, it is automatically loaded or created. To specify a
specific location for the settings file use the
The above code generates the XML settings file as follows :
<Connection DriverType = "Microsoft Excel"/>
Once you have settings established in the settings file, use the
SettingsFile.Update method to update the settings file.
Retrieving SettingsKeys and settings
To retrieve a
in the settings file you have the following options:
- Use the
- Use the
- Use the
Tip : The
method is a good option to use, when you
are not certain if the key is yet to establish in the settings file.
To retrieve a setting stored within a
SettingsKey, use the
The following code retrieves the width of a
TreeView from the settings file.
SettingsKey TreeViewSettings = SettingsFile.
int width = TreeViewSettings.GetSetting
- 04/20/2003 - Test release v0.5
- 05/11/2003 - Release v1.1 with source