Solved

how to write memo to textfile

Posted on 1998-06-16
3
267 Views
Last Modified: 2010-04-04
how do i get the text i have in my Tmemo written to a textfile?
0
Comment
Question by:tomas11
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
brainware earned 200 total points
ID: 1353316
// Use this on a Button or somthing..
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
 F : TextFile;
 I : Integer;
begin
 AssignFile(f,'mytext.txt');  // Assigns mytext to F as the Textfile
  rewrite(f); // Rewrites, Kills the File you selected
   for I:=0 to Memo1.Lines.Count do // Loops from 0 to count of lines in memo
    writeLn(f,Memo1.Lines.Strings[I]);
  CloseFile(f); // Closing the file.. Always REMEMBER this..
end;

0
 
LVL 3

Expert Comment

by:vladika
ID: 1353317
Use this

Memo.Lines.SaveToFile('mytext.txt');




0
 
LVL 3

Expert Comment

by:vladika
ID: 1353318
2brainware:

for I:=0 to Memo1.Lines.Count - 1 do // Loops from 0 to count of lines in memo
                                   ^^^^^^^^^^^

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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 antispam), the admini…

680 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