Zum Hauptinhalt springen

OpenFileDialog

Structure

OpenFileDialog(sDefaultExt, sFilter, sInitialDir, sTitle : String)

Type

Function

Description

This function will prompt the user with a File Open dialog and allow them to choose a file. The file name they select will be returned.

Parameters: 4

Parameter | Type | Description
| sDefaultExt | String | sDefaultExt specifies a file extension that is appended automatically to the selected file name, unless the selected file name already includes a registered extension. If the user selects a file name with an extension that is unregistered, sDefaultExt is appended to the unregistered extension. Extensions longer than three characters are not supported. Do not include the period (.) that divides the file name and its extension.sFilter | String | sFilter specifies the filter that should be used when browsing for files. You should pass a value that consists of a description and a mask separated by a vertical bar (pipe) character. Do not include spaces around the vertical bar. For example,

'Text files (*.txt)|*.TXT';

Multiple filters should be separated by vertical bars. For example,

'Text files (*.txt)|*.TXT|Excel files (*.xls)|*.XLS';

To include multiple masks in a single filter, separate the masks with semicolons. This works both in the Object Inspector and in program code. For example,

Excel files|*.XLS;*.XLSX';

If no value is assigned to sFilter, the dialog displays all file types.sInitialDir | String | sInitialDir is used to specify the default directory the Open Dialog should first show.sTitle | String | sTitle is used to determine the Title for the Open Dialog. |

Return Value

String - Returns the File Name that the user has selected |