Visual Basic: DataGrid Control

DataChanged Property (DataGrid)

See Also   Example   Applies To

Returns or sets a value indicating that the data in the bound control has been changed by some process other than that of retrieving data from the current record. Not available at design time.

Syntax

object**.DataChanged** [**=**value]

The DataChanged property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
value A Boolean expression that indicates whether data has changed, as described in Settings.

Settings

The settings for value are:

Setting Description
True The data currently in the control isn't the same as in the current record.
False (Default) The data currently in the control, if any, is the same as the data in the current record.

Remarks

When a data control moves from record to record, it passes data from fields in the current record to controls bound to the specific field or the entire record. As data is displayed in the bound controls, the DataChanged property is set to False. If the user or any other operation changes the value in the bound control, the DataChanged property is set to True. Simply moving to another record doesn't affect the DataChanged property.

When the data control starts to move to a different record, the Validate event occurs. If DataChanged is True for any bound control, the data control automatically invokes the Edit and Update methods to post the changes to the database.

If you don't wish to save changes from a bound control to the database, you can set the DataChanged property to False in the Validate event.

Inspect the value of the DataChanged property in your code for a control's Change event to avoid a cascading event.

Data Type

Boolean