Object Reference > True DBGrid Events > UnboundColumnFetch Event |
UnboundColumnFetch Event
The UnboundColumnFetch event is fired when a bound grid (one with its DataMode property set to 0 - Bound) needs to display the value of a cell in an unbound column as specified by the Bookmark and Col arguments.
TDBGrid_UnboundColumnFetch (Bookmark As Variant, Col As Integer, Value As Variant)
Arguments
Bookmark is a variant that identifies the row being requested.
Col is an integer that identifies the column being requested.
Value is a variant used to transfer unbound column data to the grid.
For a bound grid, any column with an empty DataField property and a non-empty Caption property is considered an unbound column.
To return an unbound value to the grid, simply set the Value argument to the desired result. If you do not assign a value, the cell will remain blank.
Use this event to implement calculated fields based on other columns or to display local data alongside remote bound data.
Your application is responsible for storing data entered into an unbound column by the user. Use the Column object's Text property to retrieve unbound values within the BeforeUpdate and BeforeInsert events.
If an unbound column is used to display a calculated result based on other columns, then you do not need to store the unbound values since they can always be calculated "on the fly" using either the Column object's Text property or data access objects.
Note
Do not confuse unbound columns with unbound mode. The UnboundColumnFetch event is only fired when a bound grid contains one or more unbound columns.
During the execution of this event, row movement is not permitted.