FileDialog.DefaultExt Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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

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

member DefaultExt : string with get, set

Property Value

Type: System.String

The default extension string. The default is Empty.

The extension string must contain the leading period. For example, set the DefaultExt property to ".txt" to select all text files.

By default, the AddExtension property attempts to determine the extension to filter the displayed file list from the Filter property. If the extension cannot be determined from the Filter property, DefaultExt will be used instead.

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
Return to top