This documentation is archived and is not being maintained.

Resources Page, Project Designer

The Resource Designer is a user interface tool that allows you to manage resources (such as strings, images, icons, audio, and files) for your project.

The Resources page of the Project Designer hosts an instance of the Resource Designer that stores and maintains resources in a single location (Resources.resx).

The Resource Designer is language-neutral and supports projects in all of the Visual Studio languages. Items that you add to the project using the Resource Designer are placed in the Resources directory for your project. The designer information is stored in Resources.resx, and code for the resource is stored in Resources.Designer.cs, .vb, or .jsl.

You can also use the Resource Designer to edit standalone .resx files. For example, if you add a resource file using Solution Explorer, its settings are kept in a separate .resx file and do not appear in the Project Designer. Double-clicking a resource's .resx file opens a separate Resource Designer for that resource.

You can edit file-based resources by double-clicking the resource in the designer. The designer opens the item in the default editor for that file type. If no editor is registered for that file type, the file is opened in the Windows default application for that type. To change the file type association, see How to: Associate an Editor with a Resource Type.

For Visual C# and Visual J#, the Resource Designer generates strongly-typed resources in the project's default namespace (specifically, ProjectName.Properties in Resources.Designer.cs). For information about accessing resources in Visual C# and Visual J#, see Adding and Editing Resources (Visual C#).

For Visual Basic, the Resource Designer generates strongly-typed resources in the My.Resources namespace (in Resources.Designer.vb). For information about accessing resources in Visual Basic through the My.Resources object, see Accessing Application Resources.

Strongly-typed resources encapsulate access to resources by creating classes that contain a set of static, read-only (get) properties at compile time. You can consume resources using the "get" properties rather than using the GetString and GetObject methods of the ResourceManager class. Strongly-typed resources also make it easier to develop localizable applications. For information on strongly-typed resources, see StronglyTypedResourceBuilder.

Resources also have a Persistence property that specifies whether they are linked or embedded. Linked resources are stored as files within the project; the .resx file stores a relative path to the file, and during compilation, the resource data is placed into the manifest for the application. With embedded resources, the resource data is stored directly in the .resx file.

By default, all new resources are linked resources, as opposed to embedded. If you try to edit an embedded resource, you will receive a message prompting you to convert the item to a linked resource in order to edit it; conversion is recommended but optional. For more information, see Linked vs. Embedded Resources.

To access the Resources page, select a project node in Solution Explorer, then on the Project menu, click Properties. When the Project Designer appears, click the Resources tab.

Resource View Selector

To view a project's resources by type, at the top-left corner of the Resources page, click the arrow and choose a resource type from the drop-down list. The choices are Strings, Images, Icons, Audio, Files, and Other. Strings is the default view.

Strings

Displays strings in a grid with columns for the Name, Value, and Comment of the string resource. You can access the resources through My.Resources at run time as String. For a description of the columns in this grid, see "Settings Grid," below.

Images

Displays all image files, including .bmp, .jpg, and .gif formats. These files are exposed at run time as Bitmap. This category also includes Windows metafiles, exposed as Metafile.

Icons

Displays icon (*.ico) files, which are exposed as Icon.

Audio

Displays sound files, including .wav, .wma, and .mp3 files. These files are exposed as byte arrays. Double-clicking an audio item opens and plays it in Windows Media Player.

Files

Displays any files that do not fit into the above categories. Items in this view can be text files exposed as String, or binary files exposed as byte arrays.

Other

Displays a settings grid for adding other types that support string serialization (for example, Font, Enum, Color, and Point). The grid contains the following columns: Name, Type, Value, and Comment. For a description of the columns in this grid, see "Settings Grid," below.

Add Resource and Remove Resource Buttons

These controls allow you add and delete resources.

Add Resource

Select an item from the Add Resource drop-down list at the top of the page to add resources. The options are Add Existing File, Add New String, New Image (PNG, BMP, GIF, JPEG, or TIFF format), Add New Icon, and Add New Text File.

Remove Resource

Select an existing resource in the settings grid (described below) and click Remove Resources to delete it.

Settings Grid

The settings grid is used to configure settings for each string resource. This grid appears only in the Strings view and in the Other view.

Name

Enter the name of the resource in this field.

Type

Specify a type that supports string serialization. (This column appears only in the Other view.)

Value

The value associated with the resource setting. For example, if the resource is a string, you would enter its text value here.

Comment

An optional comment describing the string resource. You can view this only at design time.

See Also

Show: