Back to Devexpress

XtraSaveFileDialog Class

windowsforms-devexpress-dot-xtraeditors-e61e20b6.md

latest3.9 KB
Original Source

XtraSaveFileDialog Class

A dialog that allows a user to save a file. Supports DevExpress Skins.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraDialogs.v25.2.dll

NuGet Packages : DevExpress.Win.Dialogs, DevExpress.Win.Navigation

Declaration

csharp
[DXLicenseWinFormsEditors]
public sealed class XtraSaveFileDialog :
    FileDialogBase,
    ISaveFileDialog,
    IFileDialog,
    ICommonDialog,
    IDisposable
vb
<DXLicenseWinFormsEditors>
Public NotInheritable Class XtraSaveFileDialog
    Inherits FileDialogBase
    Implements ISaveFileDialog,
               IFileDialog,
               ICommonDialog,
               IDisposable

Remarks

Use the inherited ShowDialog() method to display a modal dialog box. The skin of the dialog box matches the skin of the form that invoked that dialog (the owner form). You can also use the ShowDialog(IWin32Window) method overload to explicitly specify the owner form.

The XtraSaveFileDialog supports environment variables (for instance, %WINDIR% and %TEMP%) in the address bar.

To force all DevExpress controls and components to use XtraSaveFileDialogs instead of standard dialogs, enable the WindowsFormsSettings.UseDXDialogs property.

See the following topic on docs.microsoft.com for more information: SaveFileDialog.

Example

The following example demonstrates how to show the XtraSaveFileDialog.

csharp
using System.IO;

private void simpleButtonSaveFileDialog_Click(object sender, EventArgs e) {
    Stream memoStream;
    xtraSaveFileDialog1.Filter = "txt files (*.txt)|*.txt";

    if(xtraSaveFileDialog1.ShowDialog() == DialogResult.OK) {
        if((memoStream = xtraSaveFileDialog1.OpenFile()) != null) {
            // Code to write the stream goes here.

            memoStream.Close();
        }
    }
}
vb
Imports System.IO

Private Sub simpleButtonSaveFileDialog_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim memoStream As Stream
    xtraSaveFileDialog1.Filter = "txt files (*.txt)|*.txt"

    If xtraSaveFileDialog1.ShowDialog() = DialogResult.OK Then
        memoStream = xtraSaveFileDialog1.OpenFile()
        If memoStream IsNot Nothing Then
            ' Code to write the stream goes here.

            memoStream.Close()
        End If
    End If
End Sub

Inheritance

Object MarshalByRefObject Component CommonDialog XtraCommonDialog FileDialogBase XtraSaveFileDialog

See Also

XtraSaveFileDialog Members

DevExpress.XtraEditors Namespace