Edit: The code is in the browser, so I have no idea if it works, but it's really simple.
You should use TMemo only if you want to display data before saving it, because the task of visual control is to display something. But if you want to use the Items TMemo property to collect strings and then save them to a file, you should use a TStringList instead:
var i: Integer; sl: TStringList; begin sl := TStringList.Create; try for i := 0 to Memo1.Lines.Count-1 do sl.Add(Memo1.Lines[i]); sl.SaveToFile(sl[1]); finally sl.free; end; end;
You may also like this theme: http://www.tek-tips.com/viewthread.cfm?qid=678231
EDIT2:
Memo1.Lines.SaveToFile(edit1.text + Memo1.Lines[0]);
Provided that Edit Control is called Edit1, both your base path and the first line of TMemo have a file name. The other bit you need is Event , and I mean, if you double-click an instance of TMemo, it will be an event that will trigger a cascade to save the file.
As you can see, this is very simple, and there are other ways like SaveDialog that can make it a lot easier. but hope this answers your question.
source share