Visual Basic Reference

LoadResData Function

See Also    Example    Applies To

Loads data of several possible types from a resource (.res) file and returns a Byte array.

Syntax

LoadResData(index, format)

The LoadResData function syntax has these parts:

Part Description
index Required. Integer or string specifying the identifier (ID) of the data in the resource file. The resource whose ID is 1 is reserved for the application icon.
format Required. Value that specifies the original format of the data being returned, as described in Settings. Value can also be the string name of a user-defined resource.

Settings

The settings for format are:

Setting Description
1 Cursor resource
2 Bitmap resource
3 Icon resource
4 Menu resource
5 Dialog box
6 String resource
7 Font directory resource
8 Font resource
9 Accelerator table
10 User-defined resource
12 Group cursor
14 Group icon

Remarks

The data that LoadResData loads from the resource file can be up to 64K.

Using LoadResData with a bitmap, icon, or cursor resource type returns a string containing the actual bits in the resource. If you want to use the actual bitmap, icon, or resource, use the LoadResPicture function.

Using LoadResData is useful for localizing a Visual Basic application because the resources that need to be translated are isolated in one resource file and there is no need to access the source code or recompile the application.