ComponentOne List 8.0 for ActiveX
Redimensioning an XArrayDB Object

Before an XArrayDB object can be used, you must define its dimensions in code with the ReDim method, which is similar to its counterpart in Visual Basic. For example, the following line of code sets up a two-dimensional array with 20 rows (indexed from 1 to 20) and 4 columns (indexed from 0 to 3):

Example Title
Copy Code
MyArray.ReDim 1, 20, 0, 3

You can use the Count property to determine the number of elements in a given dimension:

Example Title
Copy Code
MyArray.ReDim 1, 20, 0, 3

Note that the index passed to the Count property is one-based. To determine the valid indexes for a given dimension, you can use the LowerBound and UpperBound properties:

Example Title
Copy Code
Debug.Print MyArray.LowerBound(1) ' prints 1

Debug.Print MyArray.UpperBound(1) ' prints 20

Debug.Print MyArray.LowerBound(2) ' prints 0

Debug.Print MyArray.UpperBound(2) ' prints 3

When an XArrayDB object is connected to a TDBList or TDBCombo control, its first dimension always specifies the row index from the list's perspective. Or, to put it another way, the set of allowable bookmarks ranges from LowerBound(1) to UpperBound(1).

Likewise, the second dimension of an XArrayDB object always specifies the column index from the list's perspective. Or, to put it another way, the list addresses data columns in the XArrayDB object using indexes that range from LowerBound(2) to UpperBound(2). Therefore, if your application manipulates columns in code, it is a good idea to make the second XArrayDB dimension zero-based instead of one-based. That way, you can use the same indexes to refer to both list columns and XArrayDB columns.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback