Delphi Save File dialog box-tsavedialog

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.