<< Click to Display Table of Contents >> User-defined data types |
You can use the Type statement to define your own data types. This must be done before declaring procedures - user-defined data types are always globally valid. The user-defined variables can be declared locally or globally.
Note: The use of arrays in user-defined types is not allowed. Furthermore, user-defined variable types cannot be passed to DLLs that expect C structures.
Type Person
LastName As String
FirstName As String
Gender As String*1 ' ("m" or "f")
Birthday As String
End Type
Variables of this type can be created like other variables with Dim or Static. The individual elements can be accessed with the point notation Variable.element (see also With statement).
Dim p As Person
p.LastName = "Smith"