Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving Text To A Folder 1

Status
Not open for further replies.

patlim88

Programmer
May 14, 2002
22
0
0
US
Hi:

I have created a memo box with a save button on a form. Does anyone know how to set the path where the text file should be saved?

Right now when you click 'Save' a pop up box comes up and the default folder is the project folder. I would like for the default to be D:\CallBack. I'm thinking the new line of code would be somewhere in these lines:

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;


Thanks.
 
Change the lines
InitialDir:=ExtractFilePath(Application.ExeName);

To
InitialDir:= 'D:\CallBack';

This should solve your problem!

 
Thanks for your reply. I changed the code per your suggestion. The application compiled but when I hit save it still has the project folder as the default.

Any more suggestions?
 
Never mind ... i found the answer. It was

SaveDialog1.InitialDir := 'D:\ForcedCall';

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top