StringLists and MemoFields

I'm using D5 and a Paradox table.  One of the items of the table is of type memo (call it Memo1).  How do I get the text out of Memo1 and into a TStringList (call it SL1).  Also, how do I create and properly initialize SL1.  I keep getting a warning that I may not have propertly initialized SL1.  Finally, I want to copy the text from SL1 to Memo1 after I'm done doing stuff.
LVL 6
tecbuilderAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
Like this:

var
  SL1 : TStringList;

begin
  SL1 := TStringList.Create;
  SL1.assign(Memo1.lines);
....

end;

Cheers,

Raymond.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
huizhangCommented:
to assign the value of a TMemo or a TDBMemo to a TStringList, you can simplly assign the Text property of the
Memo to the StringList.

SL1.Text := Memo1.Lines.Text;

Memo1.Lines.Text := SL1.Text;
0
rwilson032697Commented:
Oh, ans of course this:

Memo1.lines.assign(sl1.lines);

Cheers,

Raymond.
0
RBertoraCommented:
 I keep getting a warning that I may not have propertly initialized SL1

To get rid of that you have to initialize your stringlist you do that by clearing it.. but here is the entire declaration any way:

Sl1 := TStringList.Create;
Sl1.Clear;

Rob;-)
0
tecbuilderAuthor Commented:
Thanks for help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.