EPUB | CHM | PDF

Example: FindNearest

Top Previous Next

The following example performs an incremental search on a table.

The form contains a dbgrid, an edit box, a data source, and a table. As the user types in the edit box, the cursor of the grid moves to the nearest match in the table.

procedure TForm1.FormActivate(Sender: TObject);
begin
  PSQLTable1.TableName := 'Customer';
  PSQLTable1.Active := True;
  PSQLTable1.IndexName := 'ByCompany';
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
    PSQLTable1.FindNearest([Edit1.Text]);
end;