
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