Solved

Copy dat froma stringgrid to a memo

Posted on 2004-04-14
2
349 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 22

Accepted Solution

by:
Ferruccio Accalai earned 125 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now