SaveDialog1.InitialDir :=
ExtractFilePath(Application.ExeName);
procedure TForm1.FormCreate(Sender: TObject);
begin
with OpenDialog1 do begin
Options:=Options+[ofPathMustExist,ofFileMustExist];
InitialDir:=ExtractFilePath(Application.ExeName);
Filter:='Text files (*.txt)|*.txt';
end;
with SaveDialog1 do begin
InitialDir:=ExtractFilePath(Application.ExeName);
Filter:='Text files (*.txt)|*.txt';
end;
Memo1.ScrollBars := ssBoth;
end;
procedure TForm1.btnSaveClick(Sender: TObject);
begin
SaveDialog1.FileName := Form1.Caption;
if SaveDialog1.Execute then begin
Memo1.Lines.SaveToFile
(SaveDialog1.FileName + '.txt');
Form1.Caption:=SaveDialog1.FileName;
end;
end;