Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

how can i search info on db grid?

Posted on 1998-02-09
1
133 Views
Last Modified: 2010-04-04
i need to search an info
on the db grid
how can i do that?
and i want example
an source code of a program.
0
Comment
Question by:tomerlei
1 Comment
 
LVL 2

Accepted Solution

by:
mvz121697 earned 200 total points
ID: 1358798
You can simply search the Ttable or Tquery Component to which the dbgrid is connected to.

Example:
Put a Dbgrid, TTable and a TDatasource on your form.
Connect  the dbgrid1 to the Datasource1 (dbgrid.datasource -property)
Connect the Datasource1 to Table1 (datasource.dataset-property)

Set TTable-databasename  and TTable-TabelName, and set
active to true.
Now put a Tedit control on the form and double-click it:
Then insert the folowwing  code:


procedure TForm1.Edit1Change(Sender: TObject);
begin
 Ttable1.Locate('FieldName',Edit1.Text,[]);
end;

If the Table is indexed you can also use findKey:

 Ttable1.FindKey([edit1.Text]);

Greetings,
MvZ



0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question