GETFILE( ) Function
Displays the Open dialog box and returns the name of the file you chose.
GETFILE([cFileExtensions] [, cText] [, cOpenButtonCaption]
[, nButtonType] [, cTitleBarCaption])
Return Values
Character
Parameters
cFileExtensions
Specifies the file extensions of the files displayed in the scrollable list when the All Files menu item isn't chosen. If passing a value as a literal, enclose it in quotation marks. Do not include a period (.) in front of file extensions.cFileExtensions can take a variety of forms:
If cFileExtensions contains a single extension (for example, "PRG"), only files with that extension are displayed.
If cFileExtensions is the empty string, all files in the current directory are displayed if cCreatorType is not included.
cFileExtensions can also contain wildcards (* and ?). All files with extensions that meet the wildcard criteria are displayed. For example, if cFileExtensions is "?X?", all files with the extension .fxp, .exe, and .txt are displayed.
In Visual FoxPro for Windows, cFileExtensions can contain a file description followed by a file extension or a list of file extensions separated with commas. The file description appears in the Files of Type list box. Separate the file description from the file extension or list of file extensions with a colon (:). Separate multiple file descriptions and their file extensions with a semicolon (;).
For example, if cFileExtensions is "Text:TXT" the file description "Text" appears in the Files of Type list box and all files with a .txt extension are displayed.
If cFileExtensions is "Tables:DBF; Files:TXT,BAK" the file descriptions "Tables" and "Files" appear in the Files of Type list box. When "Tables" is chosen from the Files of Type list box, all files with a .dbf extension are displayed. When "Files" is chosen from the Files of Type list box, all files with .txt and .bak extensions are displayed.
If cFileExtensions contains just a semicolon (";"), all files without extensions are displayed.
cText
Specifies the text for the directory list in the Open dialog box.cOpenButtonCaption
Specifies a caption for the OK button.nButtonType
Specifies the number and type of buttons that appear in the Open dialog box. The following buttons appear in the dialog box when nButtonType is 0, 1, or 2.nButtonType Buttons 0 (or omitted) OKCancel 1 OKNewCancel 2 OKNoneCancel "Untitled" is returned with the path specified in the Open dialog box if nButtonType is 1 and the user chooses the New button. The empty string is returned if nButtonType is 2 and the user chooses the None button.
cTitleBarCaption
Specifies the title bar caption.
Remarks
GETFILE( ) returns the empty string if you exit the Open dialog box by pressing ESC, choosing Cancel, or choosing Close from the Control menu.
Example
CLOSE DATABASES
SELECT 0
gcTable = GETFILE('DBF', 'Browse or Create a .DBF:', 'Browse', 1; 'Browse or Create')
DO CASE
CASE 'Untitled' $ gcTable
CREATE (gcTable)
CASE EMPTY(gcTable)
RETURN
OTHERWISE
USE (gcTable)
BROWSE
ENDCASE
See Also
FULLPATH( ) | GETEXPR | GETPICT( ) | LOCFILE( ) | PUTFILE( )