a form, memo, 3 buttons button1 is save, button 2 is load, button 3 add lines to memo procedure TForm1.Button1Click(Sender: TObject); begin savedialog1.Execute; if savedialog1.FileName <> '' then memo1.Lines.SaveToFile(savedialog1.FileName); end; procedure TForm1.Button3Click(Sender: TObject); var x:integer; begin inc(x); memo1.Lines.Add(inttostr(x)); end; procedure TForm1.Button2Click(Sender: TObject); begin opendialog1.Execute; if opendialog1.FileName <> '' then begin memo1.lines.Clear; memo1.Lines.LoadFromFile(opendialog1.FileName); end; end;