Creating Application Settings Using the Designer?

D

David Veeneman

How do I persist properties bound to application settings in the VS 2005
Designer?

I am binding form and control properties to application settings using VS
2005, as explained in MSDN:

http://msdn2.microsoft.com/en-us/library/wabtadw6

Everything works fine, except my properties won't persist. The MSDN article
explains that "in languages other than Visual Basic, you must explicitly
call the Save method of this wrapper class in order to persist the user
settings." That means the class has to be instantiated, but the VS designer
doesn't appear to do that. So, how can I get to the Save() method?

Does the designer create the object I need? What is it called? Where do I
find the code that creates the object? Thanks in advance for your help.

David Veeneman
Foresight Systems
 
D

David Veeneman

I found the answer. The Settings class is a static class with one property,
Default. The Save() method belongs to the Default property. The form's
designer code contains bindings that attach form and control property
settings to application settings using that Default property.

The only problem that I'm having now is that the user settings saved when my
application closes become the design-time setting for the bound controls and
form. That isn't always what I want. It may be just as easy to skip using
the Settings class and go back to writing my user settings from a custom
class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top