Udostępnij za pośrednictwem


Rapid Application Development with My.Resources and My.Settings (Visual Basic)

The My.Resources object provides access to the application's resources and allows you to dynamically retrieve resources for your application.

Retrieving Resources

A number of resources such as audio files, icons, images, and strings can be retrieved through the My.Resources object. For example, you can access the application's culture-specific resource files. The following example sets the icon of the form to the icon named Form1Icon stored in the application's resource file.

Sub SetFormIcon()
    Me.Icon = My.Resources.Form1Icon
End Sub

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.

Similarly, the My.Settings object provides access to the application's settings and allows you to dynamically store and retrieve property settings and other information for your application. For more information, see My.Resources Object and My.Settings Object.

See Also

Reference

My.Resources Object

My.Settings Object

Concepts

Accessing Application Resources (Visual Basic)

Accessing Application Settings (Visual Basic)