AddExtension Property
Indicates whether the dialog box should automatically add the default file extension to the user-supplied file name. The default value is true.
CheckFileExists Property
Indicates whether a warning message should be displayed if the user enters the name of a file that does not exist. The default value is true.
DefaultExt Property
Defines the default file extension. The string should consist of the file extension only, without a leading period.
FileName Property
Returns the fully qualified file namethe file name with its complete path and extension. If no file is selected, the property returns an empty string.
FileNames Property
Returns an array of fully qualified file names (with complete paths and extensions) for the files selected by the user. If no file is selected, the property returns an empty array. This property returns a single-element array if the Multiselect property is False and the user selects a file.
Filter Property
Used to configure a filter string that indicates the types of files (by extension) to display in the dialog box. These types appear in the "Files of type" drop-down control on the dialog box. A single item consists of a file description, a vertical bar, and the file extension (usually "*." plus the file extension). If there are multiple extensions in a single item, they are separated by semicolons. If there are multiple items, they are separated by vertical bars. For example, the following code fragment assigns a filter string for text files and VB source code files:
Dim openPrompt As New OpenFileDialog openPrompt.Filter = _ "Text files (*.txt; *.vb)|*.txt;*.vb|" & _ "Visual Basic files (*.vb)|*.vb|" & _ "All files (*.*)|*.*"
FilterIndex Property
Indicates the selected 1-based position in the Filter property's item list. The default is 1. If the user selects a different filter, this property is updated to reflect that change.
InitialDirectory Property
Indicates the initial directory to use when first displaying the dialog.
Multiselect Property
Indicates whether the user is allowed to select more than one file.
OpenFile Method
Opens the file selected by the user, returning a Stream object. The file is opened in read-only mode.
ReadOnlyChecked Property
Indicates whether the Read Only checkbox is selected on the dialog box. The default is False.
RestoreDirectory Property
Indicates whether the current working (default) directory is restored before the dialog box closes. The default value is False.
ShowDialog Method
Displays the dialog box to the user. Once the user has dismissed the dialog box, the FileName and FileNames properties can be used to get the user's selection(s).
ShowReadOnly Property
Indicates whether the Read Only checkbox should appear on the dialog box.
Title Property
Sets the title of the dialog box.
The following code asks the user for one or more files and then displays the filenames in the Output window.