[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'DBGrids' (#lcl)

# TCustomDBGrid.DataSource

Provides access to the dataset displayed in the grid.

## Declaration

Source position: dbgrids.pas line 563

`public property TCustomDBGrid.DataSource : TDataSource read GetDataSource write SetDataSource;`

## Description

DataSource is a TDataSource property which provides access to the DataSet displayed in the database grid control. Read and write access to the property are redirected to the DataLink property.

Reading the value for DataSource returns the corresponding value stored in the TComponentDataLink instance.

Writing the value for DataSource sets the value in the TComponentDataLink instance (when they are not the same). Write access to DataSource also resets the width of columns in the grid by calling RenewColWidths. UpdateActive is called to redraw the grid control after changes to the DataSource and Columns properties.

## See also

TCustomDBGrid.DataSource |  | Provides access to the dataset displayed in the grid.
TCustomDBGrid.DataLink |  | Datalink for the component with event handlers for the linked dataset.
TComponentDataLink |  | Maintains an association between a component and a dataset.
TDataSource