ComponentOne True DataControl 8.0
Defining Memory Array Fields and Filling Arrays with Data

Array fields (columns) can be specified at design time in the Fields property page. Alternatively, the collections returned by the Fields property can be filled at run time in the WillOpenData event. Each data field definition corresponds to a column in an XArrayDB object, and the order of the fields determines the one-based column indexes. Only data fields are stored in memory arrays, not calculated fields.

At run time, when the application starts, the TData control creates an XArrayDB object containing a single row, with one column for each data field defined at design time.

If you want to pre-fill the array with data, you can create an XArrayDB object in code and assign it to the Array property of the TData control. This must be done in the control’s OpenData event. You must make sure that the number of columns in the XArrayDB object is the same as the number of True DataControl fields (not including calculating fields).

It is not necessary to create a new XArrayDB object in code. You can rely on True DataControl to create a default XArrayDB object, and then use the OpenData event to change the number of rows in the array and fill the array with data. This can be done in OpenData by operating on the XArrayDB object returned by the control’s Array property.

It is also possible to set the Array property to an XArrayDB object in code outside of True DataControl events. This will cause a refresh of the TData control (use the ChangeInProgress property to postpone the refresh). Still, the assigned XArrayDB object’s column count must coincide with the number of data fields.

If you change the underlying XArrayDB data in code, you must refresh the TData control to make its recordset reflect the changes. To refresh a TData control, call

Example Title
Copy Code
TData1.Refresh True

(Refresh method with NoEvents argument set to True).

 

 


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

Product Support Forum  |  Documentation Feedback