When you write a software you may need to store user preferences about the use he make of the program. You could need to store the preferred color scheme or the default value for any option, the preferred language and so on. I needed this functionality writing SEOMAX, i needed to store the preferred template, language, sites etc… The .Net framework offers this functionality with the My namescape in each application. You can store values in the My.Settings collection in a visual way using the SETTINGS TAB in the PROJECT WINDOW.

As you can see in the picture, you can define every type you need. In the settings TAB you can store the DEFAULT VALUES for each item.
In the SCOPE column you can choose if the setting must be saved at USER LEVEL or APPLICATION LEVEL. I used USER because i needed different preference settings for each software user.
Using the settings in the application is really simple. If we need to access the SelectedLanguage setting we just have to use My.Settings.SelectedLanguage.
As you can see it’s trivial.
If the user changes his preferred language you have to store the preference. All that you need to do is My.Settings.SelectedLanguage=newlanguage and call My.Settings.Save().
If you need to reload the settings you just need to call My.Settings.Reload().
It could be necessary to retrieve the default values for each preference. It can be done using the My.Settings.Default collection. For instance, if you need to restore the Selected Language to it’s default value you have to call My.Settings.SelectedLanguage=My.Settings.Default.SelectedLanguage and then My.Settings.Save().
It’s really simple to use these functionalities but it can be very useful.
