O'Reilly logo

Programming Visual Basic 2008 by Tim Patrick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Settings in Visual Basic 2008

The settings system in Visual Basic 2008 is a multifile, XML-based, strongly typed, and easy-to-manage configuration approach. Its file-focused methodology includes these features and benefits:

  • Data is stored in XML format for efficient processing by .NET libraries. Although it is not free-form text, XML is not overwhelmingly difficult when manual updates need to be made by mere mortals.

  • The data stored in each settings-specific file is strongly typed, reducing errors from the processing of invalid data.

  • Settings are managed on a per-application, per-user, and even per-assembly-version basis to promote security and reduce conflicts. You can also store multiple sets of settings per application as you require, such as one set of settings per document opened by your application. (I won't discuss it in this chapter, but you can search for "SettingsKey property" in the online help for additional information on this feature.)

  • Visual Studio includes a user-friendly management tool used to configure settings within an application.

  • Visual Basic has its own simple interface to make the use and update of settings at runtime easier.

But it's not all fun and games. As a developer, you have to do some of the heavy lifting, such as coming up with meaningful names for each setting ("MainFormLocation," "DatabaseConnection," etc.), and altering the behavior of your program as needed based on the stored settings.

The actual settings appear in XML files scattered throughout the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required