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
  MySQLTable1.TableName := 'Customer';
  MySQLTable1.Active := True;
  MySQLTable1.IndexName := 'ByCompany';
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
    MySQLTable1.FindNearest([Edit1.Text]);
end;