Using the First and Last Methods

From RAD Studio
Jump to: navigation, search

Go Up to Navigating Datasets


The First method moves the cursor to the first row in a dataset and sets the BOF property to True. If the cursor is already at the first row in the dataset, First does nothing.

For example, the following code moves to the first record in CustTable:

CustTable.First;
CustTable->First();

The Last method moves the cursor to the last row in a dataset and sets the EOF property to True. If the cursor is already at the last row in the dataset, Last does nothing.

The following code moves to the last record in CustTable:

CustTable.Last;
CustTable->Last();

Note: The Last method raises an exception in unidirectional datasets.

Tip: While there may be programmatic reasons to move to the first or last rows in a dataset without user intervention, you can also enable your users to navigate from record to record using the Navigating and Manipulating Records.

See Also