Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Copy dat froma stringgrid to a memo

Posted on 2004-04-14
2
Medium Priority
?
373 Views
Last Modified: 2010-04-05
Hi,

I have 2 columns in a stringgrid, I would like to copy the first columns data to memo1, and the second to memo2, how can I do this?

Thank
Asw
0
Comment
Question by:Asw
2 Comments
 
LVL 23

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
ID: 10824089
memo1.Lines.Assign(stringgrid1.Cols[1]);
memo2.Lines.Assign(stringgrid1.Cols[2]);

this will pass every cell to memo, also the topmost one....
if you don't need that simply delete it after the assigning
memo1.lines.delete(0);
memo2.Lines.delete(0);
0
 
LVL 17

Expert Comment

by:mokule
ID: 10824130
procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer;
begin
  Memo1.Clear;
  Memo2.Clear;
  for i := StringGrid1.FixedRows to stringgrid1.RowCount-1 do
    begin
    Memo1.Lines.Add(StringGrid1.Cells[StringGrid1.FixedCols,i]);
    Memo2.Lines.Add(StringGrid1.Cells[StringGrid1.FixedCols+1,i]);
    end
end;
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

972 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