ComponentOne List 8.0 for ActiveX
Attaching an XArrayDB Object to a True DBList Control

Since XArrayDB objects can only exist at run time, you must write code to associate them with a TDBList or TDBCombo control. This is done by setting the Array property:

Example Title
Copy Code
TDBList1.Array = MyArray

Once this association is made, the list will store a reference to the XArrayDB object and query it as needed to determine the contents of individual cells. When the Array property is set, the list also determines the number of rows (the first dimension) in an XArrayDB object and calibrates the vertical scroll bar accordingly.

However, the list will never adjust its column layout to match the number of columns (the second dimension) in an XArrayDB object. As with other unbound data modes, you must define the column layout yourself at design time, run time, or a combination of both. At run time, you can use the following code to clear the existing columns from a list, then create a new one for each XArrayDB column:

Example Title
Copy Code
Dim C As TrueDBList80.Column

With TDBList1.Columns

    While .Count > 0

        .Remove 0

    Wend

    While .Count < MyArray.Count(2)

        Set C = .Add(0)

        C.Visible = True

    Wend

End With

Note that newly created columns are invisible by default, so you must explicitly set their Visible property to True.

 

 


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

Product Support Forum  |  Documentation Feedback