Skip to main content
All docs
V24.1

DevExpress v24.1 Update — Your Feedback Matters

Our What's New in v24.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

File and Folder Browsers

  • 2 minutes to read

The DevExpress WinForms installation ships with two options for file and folder browsers:

Standard Explorer

#How to Show XtraSaveFileDialog

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

#How to Show XtraOpenFileDialog

The following example demonstrates how to show the XtraOpenFileDialog.

using System.IO;

private void simpleButtonOpenFileDialog_Click(object sender, EventArgs e) {
    xtraOpenFileDialog1.InitialDirectory = "c:\\";
    xtraOpenFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";

    if(xtraOpenFileDialog1.ShowDialog() == DialogResult.OK) {
        // Get the path of specified file.
        string filePath = xtraOpenFileDialog1.FileName;

        // Read the contents of the file into a stream.
        var fileStream = xtraOpenFileDialog1.OpenFile();
        using(StreamReader reader = new StreamReader(fileStream)) {
            // ...
        }
    }
}