The My.Resources object provides access to the application's resources and allows you to dynamically retrieve resources for your application. For more information, see Managing Application Resources.
The My.Resources object exposes only global resources. It does not provide access to resource files associated with forms. You must access the form resources from the form. For more information, see Walkthrough: Localizing Windows Forms.
You can access the application's culture-specific resource files from the My.Resources object. By default, the My.Resources object looks up resources from the resource file that matches the culture in My.Application.UICulture Property. However, you can override this behavior and specify a particular culture to use for the resources. For more information, see Resources in Applications.
Properties
The properties of the My.Resources object provide read-only access to your application's resources. To add or remove resources, use the Project Designer. For more information, see How to: Add or Remove Resources. Resources added through the Project Designer are accessed using My.Resources.resourceName.
You can also add or remove resource files by selecting your project in Solution Explorer and choosing Add New Item or Add Existing Item from the Project menu. Resources added this way are available using My.Resources.resourceFileName.resourceName.
Each resource has a name, category, and value, and these resource settings determine how the property to access the resource appears in the My.Resources object. For resources added in the Project Designer:
-
The name determines the name of the property,
-
The resource data is the value of the property,
-
The category determines the type of the property:
Classes
The My.Resources object exposes each resource file as a class with shared properties. The class name is the same as the name of the resource file. As described in the previous section, the resources in a resource file are exposed as properties in the class.