OpenFileName

Displays a Windows file open dialog box allowing the user to select a file name. Note, this function does not open the file.

Syntax

Rhino.OpenFileName ([strTitle [, strFilter [, strFolder [, strFilename [, strExtension]]]]])

Parameters

strTitle

Optional.  String.  A dialog box title.

strFilter

Optional.  String.  A series of string pairs that specify filters you can apply to the file. If you specify file filters, only files that match filter criteria will appear in the Files list.  The first string in the string pair describes the filter; the second string indicates the file name extension to use.  Multiple extensions may be specified by using a semicolon (the ';' character) as the delimiter. The string ends with two '|' characters. For example, the string "Text Files (*.txt)|*.txt|All Files (*.*)|*.*||" will add two filters to the Files list.

strFolder

Optional.  String.  The initial folder.

strFilename

Optional.  String.  The initial file name that appears in the Filename box. If not specified, no initial file name appears.

strExtension

Optional.  String.  The default file name extension. If the user does not include an extension in the Filename box, the specified extension is automatically appended to the file name. If this parameter is not specified, no extension is appended.

Returns

String

The file name if successful.

Null

If not successful, or on error.

Example

Dim strFilename

strFilename = Rhino.OpenFileName

If Not IsNull(strFilename) Then

MsgBox strFilename

End If

strFilename = Rhino.OpenFileName("Open", "Text Files (*.txt)|*.txt||")

If Not IsNull(strFilename) Then

MsgBox strFilename

End If

strFilename = Rhino.OpenFileName("Open", "Text Files (*.txt)|*.txt|All Files (*.*)|*.*||")

If Not IsNull(strFilename) Then

MsgBox strFilename

End If

 

openfilename.jpg

 

Also See

BrowseForFolder

OpenFileNames

SaveFileName