windowsforms-devexpress-dot-xtraeditors-dot-xtrasavefiledialog-f6bc3d50.md
Opens the user-selected file. The file is opened with read/write permissions.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.XtraDialogs.v25.2.dll
NuGet Packages : DevExpress.Win.Dialogs, DevExpress.Win.Navigation
public Stream OpenFile()
Public Function OpenFile As Stream
| Type | Description |
|---|---|
| Stream |
A Stream that stores the selected read/write file.
|
See the SaveFileDialog.OpenFile article to learn more.
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();
}
}
}
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
See Also