Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 18 Apr 2024, 08:47

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 21 Mar 2017, 06:43 
Offline

Joined: 21 Mar 2017, 05:12
Posts: 1
Dear All

Can anybody point me to the right direction of any samples/thread regarding :
- how to access a column's value of selected record
- how to access a column's value of selected records in multiple selection.

I've search the forum and I didn't think I've found them.

Thank you and best regards


Top
 Profile  
 
PostPosted: 23 Mar 2017, 17:53 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
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.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group