Link to home
Start Free TrialLog in
Avatar of roosiedb
roosiedb

asked on

Click on DBGrid to use that record...?

HELP HELP HELP

How can I use the specific record which has been selected by a click (on a row of the DBGrid) to use this record to add in a TMemo.

For example: I have a DBGrid on the form, and when I click on a specific row, the value of the field "NAME" must be added in the memobox which is located on that same form.

HELP HELP HELP

Jan van Barchum
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi roosiedb,

try this in the onclick event of your dbgrid

memo1.lines.add(dbgrid1.datasource.dataset.FieldByName('Name').AsString);

meikl ;-)

.. or this, if you want the value of the cell, the user clicked at:

procedure TForm1.DBGrid1CellClick(Column: TColumn);
begin
  Memo1.Lines.Add(Column.Field.AsString);
end;
Avatar of jconde
jconde

What really happens when you click on a record in a DBGrid is your changing the current-record pointer to the selected record.  Keeping that in mind, all you need to do is what kretzschmar and/or asem stated (which is the same) !
Avatar of roosiedb

ASKER

It worked perfect !!
How can I give you (kretzschmar) the points?
Thank you for your help.

Jan van Barchum.
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange