FileDialog.DefaultExt Property

 

Gets or sets the default file name extension.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member DefaultExt : string with get, set

Property Value

Type: System.String

The default file name extension. The returned string does not include the period. The default value is an empty string ("").

When the user of your application specifies a file name without an extension, the FileDialog appends an extension to the file name. The extension that is used is determined by the Filter and DefaultExt properties. If a filter is selected in the FileDialog and the filter specifies an extension, then that extension is used. If the filter selected uses a wildcard in place of the extension, then the extension specified in the DefaultExt property is used.

The following code example demonstrates using the RichTextBox.SaveFile and RichTextBox.LoadFile methods with streams. It also demonstrates using the FileName, DefaultExt, SaveFileDialog.CreatePrompt, and SaveFileDialog.OverwritePrompt members.

This is a complete example that is ready to run when you copy it to your project.

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

.NET Framework
Available since 1.1
Return to top
Show: