Bound Mode > Visual Basic Data Control Considerations > Interactions between True DBGrid and the Data control |
The Data control's First, Last, Next, and Previous buttons can be used to navigate through the grid or any other bound control. When a Data control button is clicked, the new current row is indicated in the record selector column of the grid:
The First and Last buttons have the same effect as the MoveFirst and MoveLast methods of the Recordset. The grid will position to the first or last row.
The Next and Previous buttons have the same effect as the MoveNext and MovePrevious methods of the Recordset. The grid will move forward or backward by one row.
If grid data has been edited, moving the record pointer using the Data control will automatically trigger an update to the database.
The grid responds to the Data control's Refresh, UpdateRecord, and UpdateControls methods as follows:
Refresh |
The grid refetches and redisplays all data. Any modifications made to the grid's current row that have not been updated to the database will be lost. After the refresh, the current cell will be the leftmost visible column of the first record, which will be displayed at the upper left corner of the grid. |
UpdateRecord |
If data in the current row has changed, the modified data in the grid will be written to the database without firing the Data control's Validate event. The pencil icon in the record selector column will disappear. The current cell and the grid display are not changed. |
UpdateControls |
Any modifications made to the grid's current row that have not been updated to the database will be discarded and data will be refreshed from the database. The current cell and the grid display are not changed. This method can be used to cancel an AddNew or Edit operation. |