ComponentOne True DBGrid Pro 8
UnboundAddData Event

 

Object Reference> True DBGrid Events> UnboundAddData Event

UnboundAddData Event

The UnboundAddData event is fired when the user adds a new row of data to an unbound grid (one with its DataMode property set to 1 - Unbound or 2 - Unbound Extended).

Syntax

TDBGrid_UnboundAddData (ByVal RowBuf As TrueDBGrid80.RowBuffer, NewRowBookmark As Variant)

Arguments

RowBuf is a RowBuffer object used to transfer new row data to the grid.

NewRowBookmark is a variant that must be set to a unique bookmark for subsequent references to the newly added row.

Remarks

This event alerts your application that it must add a new row of data to its unbound dataset.

The RowBuf argument contains a single row of data to be written to the unbound dataset. Since only one row of data can be added at a time, the value of its RowCount property will always be 1. The number of columns in a RowBuffer is given by its ColumnCount property.

The Value property of the RowBuf argument contains the cell data entered by the user. If the user did not modify a particular cell, then the corresponding entry in the Value property will contain a Null variant. In Visual Basic, the IsNull function can be used to test for this condition.

Before returning from this event, NewRowBookmark must be set to the bookmark of the newly added row, or else the user will not be able to move to another row without first canceling the new row with the Esc key.

This event will not be fired if the AllowAddNew property is set to False. Conversely, if you do not implement this event, then you must ensure that AllowAddNew is never set to True.

Note

If the add operation fails in the underlying data source, then you should set the row buffer's RowCount property to 0 to inform the grid of the failure. The grid will not display an error message, but will leave the row in a modified state. At that point, the user can either correct the data or press the Esc key to cancel the operation.

See Also

TDBGrid Control

 

 


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

Product Support Forum  |  Documentation Feedback