qck.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
User-Defined Data Types
                                                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 User-Defined Data Types
 
 ■ Visual Basic allows you to define new data types using the TYPE statement.
   A user-defined type, also called a "record variable," is an aggregate type
   made up of elementary Visual Basic types. Elements of a user-defined type
   can be different data types. For example, the following TYPE statement
   defines a type, InventoryItem:
 
         TYPE InventoryItem
              Quantity             AS LONG            'Long (4-byte) integer
              OrderPoint           AS LONG            'Long (4-byte) integer
              Cost                 AS CURRENCY        'Currency (8-byte) var
              VendorCodes(1 TO 10) AS INTEGER         '2-byte integer array
              Description          AS STRING*25       'Fixed-length string
              Number               AS STRING*10       'Fixed-length string
         END TYPE
 
 ■ A variable of a user-defined type occupies only as much storage as the sum
   of its components. Using the example above, InventoryItem takes up:
 
         4 bytes each for the two long integers (2 * 4)  = 8
         8 bytes for the currency item (1 * 8)           = 8
         20 bytes for the static array (2 * 10)          = 20
         35 bytes for the fixed-length strings (25 + 10) = 35
                                                           ══
                                             Total bytes = 71
 
 ■ You can use any of the Basic data types in a user-defined type, including
   other user-defined types. See: Basic Data Types Summary
 
 ■ Some special restrictions apply to Basic ISAM files. When you create an
   ISAM table, you create a user-defined data type by including an
   appropriate TYPE...END TYPE statement in the declarations part of your
   program. See: ISAM Data Types Summary  TYPE Statement