Displaying, Converting, and Accessing Field Values

From RAD Studio
Jump to: navigation, search

Go Up to Working with Field Components Index


Data-aware controls such as Vcl.DBCtrls.TDBEdit and Vcl.DBGrids.TDBGrid display the values associated with field components. If editing is enabled for the dataset and the controls, data-aware controls can also send new and changed values to the database. In general, the built-in properties and methods of data-aware controls enable them to connect to datasets, display values, and make updates without requiring extra programming on your part. Use them whenever possible in your database applications. For more information about data-aware control, see Using data controls.

Standard controls can also display and edit database values associated with field components. Using standard controls, however, may require additional programming on your part. For example, when using standard controls, your application is responsible for tracking when to update controls because field values change. If the dataset has a datasource component, you can use its events to help you do this. In particular, the the Data.DB.TDataSource.OnDataChange event lets you know when you may need to update a control's value and the Data.DB.TDataSource.OnStateChange event can help you determine when to enable or disable controls. For more information on these events, see Responding to changes mediated by the data source.

The following topics discuss how to work with field values so that you can display them in standard controls:

See Also