From: Hector Santos on
I think I have a basic handle of this. A confirmation or enlightenment
would be appreciated.

Saving properties to the "user.config" - self-trusted concept is
allowed, but saving to the application.exe.config requires another
level of "trust" work. I am successful in saving properties to the
user's user.config file which is probably ok, but I need understanding
and more program control options for scenarios where I want
application level options save to the application.exe.config file.

How do you save to the application.exe.config file?

--
HLS


Hector Santos wrote:

> I am trying to use the library to set/get settings. Something that
> normally isn't a hard concept when you using your own logic, but I'm
> still learning the rich library and wish to use whats there.
>
> But I don't get it. Following all examples, it doesn't seem to take.
>
> To test, I created a Windows form with 3 check boxes and using the Data
> Binding to set three corresponding settings:
>
> option1
> option2 default checked
> option3
>
> How do use this in code so that user changes stick on saving and loading?
>
> Maybe I am seeing this wrong. Its only for the default settings?
>
> I don't wish to hand code the load/saving for each control/option, isn't
> that defeating the purpose of the "Data/Property Binding" using its
> inherent enumeration interface?
>
> Thanks
>
>



--
HLS
From: Peter Duniho on
Hector Santos wrote:
> Ok using
>
> Properties.Settings.Default.Save()
>
> Seem to work but its not using the applet.exe.config. It must be using
> a user.config setting under the user's document folder.
>
> I have to thing about this, but I need it to save the to the
> applet.exe.config files.

There's no "applet.exe.config". I assume you're talking about the
app.config file, which contains application-level settings, rather than
user-level settings.

Using the Designer-provided class, the application-level settings are
read-only. You can edit them in the Designer, but at run-time they
cannot be saved.

This is, by the way, at least in part in order to encourage people to
write better programs. It is a bad idea to maintain application-level
settings that can be modified by individual users, at least through the
main application.

If you want for users to be able to modify application-level settings
(i.e. settings that will apply to every user using the program), you
should provide a separate program that allows for the modification of
the first program's application-level settings, or at least provide a
very clear UI completely separated from the main UI in the original program.

And yes, to modify the application-level settings in the app.config file
you'll have to use the ConfigurationManager support directly, rather
than through the Designer-provided class. It will be somewhat more
involved than dealing with the user-level settings, and this is to at
least some extent an intentional design.

Pete