RAD Studio VCL Reference
|
Contains the individual lines of text in the memo control.
property Lines: TStrings;
__property TStrings Lines;
Use Lines to manipulate text in an memo control on a line-by-line basis. Lines is a TStrings object, so the TStrings methods may be used for Lines to perform manipulations such as counting the lines of text, adding new lines, deleting lines, or replacing lines with new text.
To work with all the text at once, use the Text property. To manipulate individual lines of text, the Lines property works better.
C++ Examples:
/* This example uses a button and a memo control on a form. When the user clicks the button, the content of the specified file is loaded into the memo, and the fifth line of the file is written across the top of the form. */ void __fastcall TForm1::Button1Click(TObject *Sender) { Memo1->Lines->LoadFromFile("../readme.txt"); Caption = Memo1->Lines->Strings[4]; }
Delphi Examples:
{ This example uses a button and a memo control on a form. When the user clicks the button, the content of the specified file is loaded into the memo, and the fifth line of the file is written across the top of the form. } procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines.LoadFromFile('readme.txt'); Caption:= Memo1.Lines[4]; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|