Object Reference > True DBGrid Events > ClassicWrite Event |
ClassicWrite Event
The ClassicWrite event is fired when the user modifies an existing row within an application mode grid (one with its DataMode property set to 3 - Application) and attempts to commit the changes by moving to a different row or by calling the Update method.
TDBGrid_ClassicWrite (Bookmark As Variant, ByVal Col As Integer, Value As Variant)
Arguments
Bookmark is a variant that uniquely identifies the row to be updated.
Col is an integer that identifies the column to be updated.
Value is a variant used to transfer data from the grid to the unbound data source.
This event alerts your application that it must update the cell specified by the Bookmark and Col arguments within its unbound dataset.
The Bookmark argument contains a bookmark supplied by your application in either the ClassicRead or ClassicAdd event.
The Value argument contains the cell data entered by the user.
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 Bookmark argument to Null.
You can force the ClassicWrite 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.