ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.BeforeUpdate Event

Occurs before a row is updated to the datasource.

[Visual Basic]

Public Event BeforeUpdate As CancelEventHandler

[C#]

public event CancelEventHandler BeforeUpdate

[Delphi]

public property BeforeUpdate: CancelEventHandler read remove_BeforeUpdate write add_BeforeUpdate;

Remarks

When the user moves to another row, or the UpdateData method of the grid or DataSet object is executed, data is moved from the grid's copy buffer to the DataSet's copy buffer and then written to the database.

Just before the data is moved from the grid's copy buffer back into the DataSet's copy buffer, the BeforeUpdate event is triggered. Unless the copy operation is canceled, the AfterUpdate event is triggered after the data has been moved back into the DataSet's copy buffer and written to the database.

The Bookmark property can be used to access the updated record.

If your event procedure sets the CancelEventArgs.Cancel property to True, focus remains on the control, the AfterUpdate event is not triggered, and the record is not saved to the database.

Use this event to validate data in a record before permitting the user to commit the change to the DataSet's copy buffer. Setting the CancelEventArgs.Cancel property to True prevents the user from moving focus to another control until the application determines whether the data can be safely moved back to the DataSet's copy buffer.

Example

For more details on the BeforeUpdate event, see the Updating Unbound Columns topic.

See Also

C1TrueDBGrid Class | C1TrueDBGrid Members | C1.Win.C1TrueDBGrid Namespace


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.