ShowFilePicker

<< Click to Display Table of Contents >>

 

ShowFilePicker

ShowFilePicker(Open, Filename, [Extension], [Flags], [Filter])

Displays Windows Save and Open File dialog boxes. The Open parameter indicates a type of dialog box to open. If True, opens the Open File dialog box. If False, opens the Save dialog box. The Filename parameter indicates a variable to store the file name to save or load, in case this method returns True. This parameter must be a variable. The Extension parameter is optional and informs the default file extension to attach to the file name on this dialog box, when no extension is informed. In case it is omitted or an empty String, no extension is attached at the end of the file name. Multiple extensions can be specified by using a semicolon as a delimiter. This String must end with double vertical bars (||).

The Flags parameter is optional and defines dialog box's behavior. This is an integer corresponding to the sum of values from the next table. If omitted, assumes the value 2 (two, FILEMUSTEXIST). The Filter parameter is optional and defines a set of String pairs specifying filters that can be applied to files. The first String describes a filter and the second one indicates a type of extension to use. If omitted, no filter is applied to files.

Possible combinations for Flags parameter

Value

Description

1

CREATEPROMPT: If users specify a non-existing file, this flag allows asking about the creation of this file. If users choose to create this file, this dialog box is closed and the file name is returned in the Filename parameter. Otherwise, this dialog box remains open

2

FILEMUSTEXIST: Specifies that users can only type existing file names. Otherwise, this dialog box displays a warning on the message box

4

NOCHANGEDIR: Recovers the current directory to its original value in case users have changed the directory while searching for a file

8

NODEREFERENCELINKS: Configures this dialog box to return the selected shortcut file (.lnk). If this flag is not specified, this dialog box returns the path and file name referenced by the shortcut file

16

NOREADONLYRETURN: Determines that the returned file is not read-only, and the directory is not record-protected

32

PATHMUSTEXIST: Specifies that users can only inform valid files and directories, otherwise a message box is displayed to warn users

64

READONLY: Allows the Read Only option to be initially selected when this dialog box is created

128

OVERWRITEPROMPT: Allows the Save As dialog box to generate a message informing that this file exists, and asks for confirmation to overwrite it

 

Filter example:

"Chart Files (*.xlc)|*.xlc|Excel spreadsheets (*.xls)_
  |*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls
  |All files (*.*)|*.*||"

Was this page useful?