Read Application Configuration Settings

Problem

You need to store application-specific settings that can be modified easily without recompiling code.

Solution

Read settings from an application configuration file.

Discussion

Configuration files are ideal repositories for information such as directory paths and database connection strings. One useful feature about configuration files is the fact that they are tied to a particular directory, not a particular computer (as a registry setting would be). Thus, if several clients load the same application from the same directory, they will share the same custom settings. However, you might need to add additional security to prevent users from reading or modifying a configuration file that is shared in this ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.