Back to Devexpress

VGridControlBase.RestoreLayoutFromStream(Stream) Method

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

latest3.7 KB
Original Source

VGridControlBase.RestoreLayoutFromStream(Stream) Method

SECURITY-RELATED CONSIDERATIONS

Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.

Restores a vertical grid’s layout from 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 RestoreLayoutFromStream(
    Stream stream
)
vb
Public Overridable Sub RestoreLayoutFromStream(
    stream As Stream
)

Parameters

NameTypeDescription
streamStream

A Stream descendant from which the vertical grid’s settings are read. If null ( Nothing in Visual Basic), an exception is raised.

|

Remarks

Use the RestoreLayoutFromStream method to load the vertical grid’s layout from the stream to which the layout was saved via the VGridControlBase.SaveLayoutToStream 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

RestoreLayoutFromRegistry

RestoreLayoutFromXml

Save and Restore Layouts of DevExpress controls

VGridControlBase Class

VGridControlBase Members

DevExpress.XtraVerticalGrid Namespace