ComponentOne True DBGrid Pro 8
UnboundWriteData Event

 

Object Reference> True DBGrid Events> UnboundWriteData Event

UnboundWriteData Event

The UnboundWriteData event is fired when the user modifies an existing row within an unbound grid (one with its DataMode property set to 1 - Unbound or 2 - Unbound Extended) and attempts to commit the changes by moving to a different row.

Syntax

TDBGrid_UnboundWriteData (ByVal RowBuf As TrueDBGrid80.RowBuffer, WriteLocation As Variant)

Arguments

RowBuf is a RowBuffer object used to transfer modified row data from the grid to the unbound data source.

WriteLocation is a variant bookmark that uniquely identifies the row to be updated.

Remarks

This event alerts your application that it must update the row specified by the WriteLocation argument within 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 updated 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 WriteLocation argument contains a bookmark supplied by your application in either the UnboundReadData, UnboundReadDataEx, or UnboundAddData event.

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, not the current cell contents. In Visual Basic, the IsNull function can be used to test for this condition.

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

Note

If the update 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.

You can force the UnboundWriteData event to occur in code by calling the Update method. This method is particularly valuable when the unbound dataset contains a single row and AllowAddNew is False, since there is no way for the user to trigger the update by moving to another row in this case.

See Also

TDBGrid Control

 

 


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

Product Support Forum  |  Documentation Feedback