ResourceViewer Technology Sample

This sample provides a viewer for strongly typed resources. It loads and analyzes resource files that are generated by the Resource File Generator (Resgen.exe) utility, and displays details about the resources stored in them, using a DataGridView. This sample is available only in C#.

For information about using the samples, see the following topics:

To build the sample using the Command Prompt

  1. Open a command prompt window and navigate to the ResourceViewer directory.

  2. Type msbuild ResourceViewer.sln at the command line.

To build the sample using Visual Studio

  1. Open Windows Explorer and navigate to the ResourceViewer directory.

  2. Double-click the icon for ResourceViewer.sln to open the file in Visual Studio.

  3. Choose Build Solution from the Build menu, or press F5 to build and run the sample.

To run the sample

  1. Open a command prompt window or Windows Explorer and navigate to the directory that contains the new executable.

  2. Type ResourceViewer.exe at the command line, or double-click the icon in Windows Explorer to launch and run the sample.

  3. In the sample window, choose Open Resource File from the File menu. The contents of the file are displayed in the DataGridView at left.

Note

If you select an empty resource file, no message is displayed to inform you of that fact. The application does nothing.

Requirements

.NET Framework Version: 2.0

Demonstrates

  • Strongly typed resources.

  • Generic collections using custom types.

  • Use of type DataGridView to display lists of values.

Remarks

The sample declares and uses a custom structure named resource. It uses this structure in a generic Dictionary<TKey, TValue> to store and retrieve values from the resource file.

See Also

Concepts

Creating Resource Files

Retrieving Resources in .Resources Files

Reference

DataGridView

Dictionary<TKey, TValue>

ResourceReader

System.Resources

Other Resources

Controls to Use on Windows Forms