Solved

how to write memo to textfile

Posted on 1998-06-16
3
248 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

896 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

13 Experts available now in Live!

Get 1:1 Help Now