RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Personalization with Application Settings in Visual Basic

Application Settings is a new feature in Windows Forms 2.0 that allows you to maintain both user- and application-specific data (known as settings). Find out how to use it to improve your application's usability with personalization--this time in Visual Basic.

y previous article discussed the new Application Settings feature in Windows Forms 2.0. The article demonstrated this feature using C#. However, the application settings feature is also available in Visual Basic. Thus, this article continues my exploration of this new feature, this time round, focusing on how you can automatically bind the application settings to your Windows Forms controls, as well as incorporate application settings into your custom controls.

Figure 1. Creating an Application Setting: A user-scope FormLocation setting of type System.Drawing.Point.

Creating Application Settings
Using Visual Studio 2005, create a new Windows application project using Visual Basic and name it as AppSettings. Just as in C#, go to the properties page of a project and create application settings in the Settings tab. Figure 1 shows a user-scope FormLocation setting of type System.Drawing.Point.

To programmatically access the settings during runtime, use the My.Settings namespace, like this:

          '---assign a value to the setting---
        My.Settings.FormLocation = Me.Location

          '---access the value of a setting---
        Me.Location = My.Settings.FormLocation

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date