Managing the Record LengthThe length specified by the Len = intRecordLength option is used by random-access files as the size of data records that will be passed from Visual Basic to the file. This size is necessary when accessing records from a file. The first record in a file begins at location 1, and all subsequent records are written at locations in increments of 1. The actual location in the file of any given record is N x intRecordLength, where N is the record number.
Accessing records operates quite like the way you access arrays. Whereas the first element in an array is stored in Array(0), the first element in a file is stored at record number 1. To make index coordination between arrays and files easy, use Option Base 1 in your Declarations section or define your arrays to begin with element 1 and ignore the 0 subscript. |
|
![]() |
![]() |
|||