Hello
You can use TColumnEh.DisplayText to access Display Value of the cell in Colum for the Current Row.
You can use DBGridEh1.SelectedRows to access list of selected rows in the Grid.
Here is the Demo code
Code:
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin
if DBGridEh1.SelectedRows.Count = 0 then
begin
DBMemoEh1.Lines.Add(DBGridEh1.Columns[0].DisplayText);
end else
begin
DBGridEh1.SaveBookmark;
MemTableEh1.DisableControls;
for i := 0 to DBGridEh1.SelectedRows.Count-1 do
begin
MemTableEh1.Bookmark := DBGridEh1.SelectedRows[i];
DBMemoEh1.Lines.Add(DBGridEh1.Columns[0].DisplayText);
end;
MemTableEh1.EnableControls;
DBGridEh1.RestoreBookmark;
end;
end;
Here we add values of the first column of the Grid to the lines of DBMemoEh1 component.
If there are no selected records the value of the current record is used.