Q

Proper way to save configuration settings in the .NET environment?

In the past I have used .INI files or the Registry to save program configuration settings. What is the proper way...

to save configuration settings in the .NET environment? As you might expect, the format is XML. To persist config settings such as properties of a form, we need to write to a config settings file. We use what are called dynamic properties.

Basically it goes like this:

You set up a dynamic property in the IDE for an object such as a form. The IDE creates an app.config file, an entry in the file for the property and adds code to the form to read the property from the file. You won't even break a sweat!

Now you're all set to read the config file and set the properties of your form, but there is more work to do to persist the properties dynamically.

To do that, you need to load the XML config file, walk the DOM to get the setting for each persisted property and then of course set the properties properly in the app. It is much easier than it sounds! In the MSDN help there is an article that has examples. Here is the URL for the online version.

To find it in your local version of MSDN search on "Creating Your Own Dynamic Properties."

This was last published in June 2002

Dig Deeper on Visual Basic .NET Web services

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close