Solved

how to write memo to textfile

Posted on 1998-06-16
3
242 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
Comment Utility
// 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
Comment Utility
Use this

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




0
 
LVL 3

Expert Comment

by:vladika
Comment Utility
2brainware:

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

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

15 Experts available now in Live!

Get 1:1 Help Now