Prev Page Next Page
Dim Type
Previous Top Next

Declares structure variables, which are actually arrays. The Dim Type(...) statement is provided to automatically define and initialise indexer variables for use with the array.variable syntax that can be used to access array elements. These indexer variables are local or global variables, depending upon where the Type statement is invoked. and whether a global variable of that name already exists. Once their values are automatically assigned by Type care needs to be taken not to unwittingly assign different values to the indexer variables unless this is what is really intended.

The leftmost variable in the Type statement corresponds to index 0 into the array, the next index one and so on. The array length is the number of indexers declared in the Type statement. Arrays of up to two dimensions of structures may be declared.

While arrays cannot be passed as parameters to Sub and received as return values they can be indirectly accessed by GetItem, GetLength and SetItem which accept an array name as a string to identify the array. This allows an array name to be passed as a parameter to a Sub to define the array that the Sub should manipulate.

Syntax: Dim Type(indexer0, indexer1 ...)VariableName[(Length1[, Length2])]

Example:
Dim Type(name, address1, address2)items(10, 2)
...
mailitem.name(3, 1) = "Fred"

  
Prev Page Next Page
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)