Tsavedialog inherits from Topendialog and only describes the following:
1,Tsavedialog How to set the default path to save is the folder where the current program is located:
The default directory is the directory where the current program should be set property Initialdir:
Opendialog1. Initialdir: = Extractfilepath (Application. EXEName); Savedialog1. Initialdir: = Extractfilepath (Application. EXEName);
2, set filter, processing file suffix
Procedure Tform1.button5click (Sender:tobject); Beginsavedialog1.filter: = ' *.txt|*.txt '; Set the filter to save only txtif Savedialog1.execute then begin If Extractfileext (savedialog1. FileName) <> '. txt ' then//determine if the file name suffix is . txt savedialog1.filename: = Changefileext (Savedialog1.filename, '. txt ‘); No, No. Modify the suffix to. txt
Memo2.Lines.SaveToFile (Savedialog1. FileName); Save File end;end;
Delphi Save File dialog box-tsavedialog