OpenFileDialog Class

OpenFileDialog Class

 

Represents a common dialog box that allows a user to specify a filename for one or more files to open.

Namespace:   Microsoft.Win32
Assembly:  PresentationFramework (in PresentationFramework.dll)

System::Object
  Microsoft.Win32::CommonDialog
    Microsoft.Win32::FileDialog
      Microsoft.Win32::OpenFileDialog

public ref class OpenFileDialog sealed : FileDialog

NameDescription
System_CAPS_pubmethodOpenFileDialog()

Initializes a new instance of the OpenFileDialog class.

NameDescription
System_CAPS_pubpropertyAddExtension

Gets or sets a value indicating whether a file dialog automatically adds an extension to a file name if the user omits an extension.(Inherited from FileDialog.)

System_CAPS_pubpropertyCheckFileExists

Gets or sets a value indicating whether a file dialog displays a warning if the user specifies a file name that does not exist.(Inherited from FileDialog.)

System_CAPS_pubpropertyCheckPathExists

Gets or sets a value that specifies whether warnings are displayed if the user types invalid paths and file names.(Inherited from FileDialog.)

System_CAPS_pubpropertyCustomPlaces

Gets or sets the list of custom places for file dialog boxes. (Inherited from FileDialog.)

System_CAPS_pubpropertyDefaultExt

Gets or sets a value that specifies the default extension string to use to filter the list of files that are displayed.(Inherited from FileDialog.)

System_CAPS_pubpropertyDereferenceLinks

Gets or sets a value indicating whether a file dialog returns either the location of the file referenced by a shortcut or the location of the shortcut file (.lnk).(Inherited from FileDialog.)

System_CAPS_pubpropertyFileName

Gets or sets a string containing the full path of the file selected in a file dialog.(Inherited from FileDialog.)

System_CAPS_pubpropertyFileNames

Gets an array that contains one file name for each selected file.(Inherited from FileDialog.)

System_CAPS_pubpropertyFilter

Gets or sets the filter string that determines what types of files are displayed from either the OpenFileDialog or SaveFileDialog.(Inherited from FileDialog.)

System_CAPS_pubpropertyFilterIndex

Gets or sets the index of the filter currently selected in a file dialog.(Inherited from FileDialog.)

System_CAPS_pubpropertyInitialDirectory

Gets or sets the initial directory that is displayed by a file dialog.(Inherited from FileDialog.)

System_CAPS_pubpropertyMultiselect

Gets or sets an option indicating whether OpenFileDialog allows users to select multiple files.

System_CAPS_pubpropertyReadOnlyChecked

Gets or sets a value indicating whether the read-only check box displayed by OpenFileDialog is selected.

System_CAPS_pubpropertyRestoreDirectory

This property is not implemented. (Inherited from FileDialog.)

System_CAPS_pubpropertySafeFileName

Gets a string that only contains the file name for the selected file.(Inherited from FileDialog.)

System_CAPS_pubpropertySafeFileNames

Gets an array that contains one safe file name for each selected file.(Inherited from FileDialog.)

System_CAPS_pubpropertyShowReadOnly

Gets or sets a value indicating whether OpenFileDialog contains a read-only check box.

System_CAPS_pubpropertyTag

Gets or sets an object associated with the dialog. This provides the ability to attach an arbitrary object to the dialog.(Inherited from CommonDialog.)

System_CAPS_pubpropertyTitle

Gets or sets the text that appears in the title bar of a file dialog.(Inherited from FileDialog.)

System_CAPS_pubpropertyValidateNames

Gets or sets a value indicating whether the dialog accepts only valid Win32 file names.(Inherited from FileDialog.)

NameDescription
System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodOpenFile()

Opens a read-only stream for the file that is selected by the user using OpenFileDialog.

System_CAPS_pubmethodOpenFiles()

Creates an array that contains one read-only stream for each file selected by the user using OpenFileDialog.

System_CAPS_pubmethodReset()

Resets all OpenFileDialog properties to their default values.(Overrides FileDialog::Reset().)

System_CAPS_pubmethodShowDialog()

Displays a common dialog.(Inherited from CommonDialog.)

System_CAPS_pubmethodShowDialog(Window^)

Displays a common dialog.(Inherited from CommonDialog.)

System_CAPS_pubmethodToString()

Returns a string that represents a file dialog.(Inherited from FileDialog.)

NameDescription
System_CAPS_pubeventFileOk

Occurs when the user selects a file name by either clicking the Open button of the OpenFileDialog or the Save button of the SaveFileDialog.(Inherited from FileDialog.)

The following figure shows an OpenFileDialog for Windows Vista.

Open dialog box

Starting in Windows Vista, open and save file dialog boxes have a Favorite Links panel on the left side of the dialog box that allows the user to quickly navigate to a different location. These links are called custom places. Use the CustomPlaces property to set this list of links.

You cannot declare this managed class in XAML.

The following example shows how to create an OpenFileDialog that contains a default file name and extension type.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft