Object Reference > True DBGrid Methods > Refresh Method |
Refresh Method
For a TDBGrid or TDBDropDown control, the Refresh method discards all data and repopulates all cells from a data source control and/or unbound events.
object.Refresh
Arguments
None
Return Value
None
It also repaints the control's visible cells, firing all events necessary for redisplay.
When a control is refreshed, it attempts to restore the current and topmost rows. This behavior differs from the intrinsic Data control's Refresh method, which makes the first available row both current and topmost.
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.
For a Column object, the Refresh method repaints the entire column. Normally, the grid repaints automatically as needed. However, if you have written handlers for the Paint or OwnerDrawCell events, you can use this method to force a column to be repainted and hence cause the appropriate events to fire.
Note
If the grid's data source has been disconnected with the Close method, calling Refresh will implicitly ReOpen the data source and set the current row to the first available row.