Skip to content

TDataSet.MoveBy

Move the cursor position.

Declaration

Source position: db.pas line 2083

public 
function TDataSet.MoveBy(Distance: LongInt) : LongInt;

Description

MoveBy moves the current record pointer with Distance positions. Distance may be a positive number, in which case the cursor is moved forward, or a negative number, in which case the cursor is moved backward. The move operation will stop as soon as the beginning or end of the data is reached. The TDataset.BeforeScroll and TDataset.AfterScroll events are triggered (once) when this method is called. The function returns the distance which was actually moved by the cursor.

Errors

A negative distance will result in an EDatabaseError exception on unidirectional datasets.

See also

Name Description
TDataset.RecNo Current record number.
TDataset.BeforeScroll Event triggered before the cursor changes position.
TDataset.AfterScroll Event triggered after the cursor has changed position.