Connie McBride
Connie McBride

Reputation: 35

How to detect last record, delphi

Weird question, but this is where I'm at. I have a next/previous button on a form, which goes next/prior on the dataset. I have code disables previous when BOF, and disables next when EOF. problem is those flags not getting to BOF/EOF, unless I go PAST the first/last record, so I have to click them twice when I am at the first record, or at the last record. Using recno won't work because of sorting stuff (already tried that) so, how do I detect the first and last records?

Upvotes: 0

Views: 956

Answers (1)

Uwe Raabe
Uwe Raabe

Reputation: 47714

For Eof:

  DataSet.DisableControls;
  try
    DataSet.Next;
    if not DataSet.Eof then
      DataSet.Prior;
  finally
    DataSet.EnableControls;
  end;

Similar for Bof.

Upvotes: 3

Related Questions