DelphiFAQ Home Search:
General :: Programming :: Delphi :: Database
Database development with Delphi. Includes issues with BDE, ADO and InterBase.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

Allow Incremental Searching in your TDataSets

If you implement your search box (against a TDataSet) with a regular Locate() or FindKey() call requires that the user has typed in the exact search expression.
It is much more handy to jump to the first match based on a partial search.
E.g. if your user searches for the month 'August' in the list of 12 months' names, the user would type in 'A' and the cursor would jump to 'April'. Then the user would type the second letter.. 'u' and 'August' would be selected.

This is called 'Incremental Searching'.

The following piece of code shows how to do it - put it as the onChange event handler of your form's edit box.

 procedure TForm1.Edit1Change(Sender: TObject);
   // empty? then do nothing!
   if Edit1.Text='' then
   //goto nearest match
   with Table1
     FieldByName('Month').AsString := Edit1.Text;

Generated 20:01:22 on Jun 18, 2018