ComponentOne True DBGrid Pro 8
ReBind Method

 

ReBind Method

This method re-establishes the connection with the bound data source, causing the control to perform the same operations that occur when you set the DataSource property at design time.

Syntax

object.ReBind

Arguments

None

Return Value

None

Remarks

If you have not modified the grid columns at design time, then executing the ReBind method will reset the columns, headings, and other properties based on the current data source.

However, if you have altered the columns in any way at design time (even if you leave the DataField properties blank), then the grid will assume that you wish to maintain the modified grid layout and will not automatically reset the columns.

For an unbound grid with its DataMode property set to 2 - Unbound Extended or 3 - Application, this method discards all data and fires the UnboundReadDataEx or ClassicRead event to refill the grid with records from the unbound data source. After the grid has finished refilling its cache, it fires the FirstRowChange and RowColChange events.

For backward compatibility with earlier versions, the semantics of the Refresh and ReBind methods are reversed in DataMode 1 - Unbound. The ReBind method attempts to restore the current and topmost rows, but the Refresh method does not.

Note

To force the grid to reset the column bindings even if the columns were modified at design time, invoke the ClearFields method immediately before ReBind. Conversely, to cancel the grid's automatic layout response and force the grid to use the current column/field layout, invoke the HoldFields method immediately before ReBind.

The HoldFields method is especially useful in the unbound modes when you have specified the column layout in code and would like to keep it intact after a ReBind operation.

See Also

TDBGrid Control

TDBDropDown Control

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback