N
N
nichego_neznayka2015-03-31 15:20:00
Delphi
nichego_neznayka, 2015-03-31 15:20:00

How to extract selected record from DBgrid in Delphi?

Good afternoon . I use DBGrid in the program. How can I extract the selected record from it and display all the information from the row in the memo field?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Fedoryan, 2015-03-31
@AnnTHony

Delphey is not at hand, but here are a few options:
- add DBEdit components and the values ​​from the corresponding columns will be automatically displayed there;
- use the Select property of the DataSet to find out which row is selected.

M
M_PRO, 2015-04-04
@M_PRO

If you do exactly what you ask:

var
  DataSet: TDataSet;
begin
  DataSet := MyDBGrid.DataSource.DataSet;
  for Index := 0 to DataSet.FieldCount - 1 do
  begin
    MyMemo.Lines.Add(DataSet.Fields[Index].FieldName + ': ' + DataSet.Fields[Index].AsString);
  end;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question