Monday, April 7, 2008

Resource Files

A resource file is a sort of container in which you can add things that will get compiled into your dll when you build your project. Once you add an item to the resource file, a static property is created on the resource file so you can access it in your code.
Using a Resource File:
1. Right-click on your project and select Add > New Item... .
2. Select "Resource File" in the dialog box and click OK.
3. Add a string to the resource file.
4. Now you can reference this new string in code like this:
command.CommandText = string.Format(Resource1.PeopleQuery, "'VT'");

More Info: MSDN: Adding and Editing Resources