[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

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.
0
tecbuilder
Asked:
tecbuilder
1 Solution
 
rwilson032697Commented:
Like this:

var
  SL1 : TStringList;

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

end;

Cheers,

Raymond.
0
 
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

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now