Database Programming Techniques > Accessing and Manipulating Cell Data > Retrieving a bookmark relative to the current record |
To retrieve a bookmark relative to the current record, use the grid's GetBookmark method, which accepts an integer offset that specifies the number of records after the current record if positive, or before the current record if negative:
Example Title |
Copy Code
|
---|---|
Dim Bmk As Variant ' Current row. Bmk = TDBGrid1.GetBookmark(0) ' Next row. Bmk = TDBGrid1.GetBookmark(1) ' Previous row. Bmk = TDBGrid1.GetBookmark(-1) ' Fourth row after current row. Bmk = TDBGrid1.GetBookmark(4) |
Note that the record referred to by the GetBookmark method need not be visible on the screen.