advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
Average Rating: 4.7/5 | Rate this item | 3 users have rated this item.
 

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.  


advertisement
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
  Next Page: Binding Property Grids to User Settings
Page 1: IntroductionPage 3: Handling Settings Events
Page 2: Binding Property Grids to User SettingsPage 4: Adding a Second Instance of UserControl1
Please rate this item (5=best)
 1  2  3  4  5
advertisement