Skip to main content

XtraSaveFileDialog.OpenFile() Method

Opens the user-selected file. The file is opened with read/write permissions.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraDialogs.v24.1.dll

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

Declaration

public Stream OpenFile()

Returns

Type Description
Stream

A Stream that stores the selected read/write file.

Remarks

See the SaveFileDialog.OpenFile article to learn more.

Example

The following example demonstrates how to show the XtraSaveFileDialog.

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();
        }
    }
}
See Also