Provides properties and classes for accessing the application's resources.
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.
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.
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. However, you can override this behavior and specify a particular culture to use for the resources. For more information, see .
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 resourceName.. Resources added through the Project Designer are accessed using My.Resources.
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:
Category Property data type
The UnmanagedMemoryStream class derives from theclass, so it can be used with methods that take streams, such as the .
String for text files.
Bitmap for image files.
Icon for icon files.
UnmanagedMemoryStream for sound files.
Determined by the information in the designer's Type column.
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.
This example sets the icon of the form to the icon named Form1Icon that is stored in the application's resource file.
For this example to work, your application must have an icon named Form1Icon in the application's resource file. For more information, see.