Solved

how to write memo to textfile

Posted on 1998-06-16
3
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month11 days, 6 hours left to enroll

631 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