Back to Devexpress

VGridControlBase.SaveLayoutToStream(Stream) Method

windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrolbase-dot-savelayouttostream-x28-system-dot-io-dot-stream-x29.md

latest3.3 KB
Original Source

VGridControlBase.SaveLayoutToStream(Stream) Method

Saves a vertical grid’s layout to the specified stream.

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

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

Declaration

csharp
public virtual void SaveLayoutToStream(
    Stream stream
)
vb
Public Overridable Sub SaveLayoutToStream(
    stream As Stream
)

Parameters

NameTypeDescription
streamStream

A Stream descendant to which a vertical grid’s layout is written.

|

Remarks

Use the SaveLayoutToStream method to write a vertical grid’s layout to a stream. The layout can then be read using the VGridControlBase.RestoreLayoutFromStream method.

Example

The following sample code saves the vertical grid’s layout to a file stream and then applies it to another vertical grid. The VGridControlBase.SaveLayoutToStream and VGridControlBase.RestoreLayoutFromStream methods are used for this purpose.

csharp
using System.IO;

string fileName = "C:\\XtraVerticalGridLayout";
FileStream outFile = new FileStream(fileName, FileMode.Create);
vGridControl1.SaveLayoutToStream(outFile);
outFile.Close();
vGridControl2.DataSource = vGridControl1.DataSource;
FileStream inFile = new FileStream(fileName, FileMode.Open);
vGridControl2.RestoreLayoutFromStream(inFile);
inFile.Close();
vb
Imports System.IO

Dim fileName As String = "C:\XtraVerticalGridLayout"
Dim outFile As New FileStream(fileName, FileMode.Create)
VGridControl1.SaveLayoutToStream(outFile)
outFile.Close()
VGridControl2.DataSource = VGridControl1.DataSource
Dim inFile As New FileStream(fileName, System.IO.FileMode.Open)
VGridControl2.RestoreLayoutFromStream(inFile)
inFile.Close()

See Also

SaveLayoutToRegistry

SaveLayoutToXml

Save and Restore Layouts of DevExpress controls

VGridControlBase Class

VGridControlBase Members

DevExpress.XtraVerticalGrid Namespace