Back to Devexpress

VGridControlBase.SaveLayoutToRegistry(String) Method

windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrolbase-dot-savelayouttoregistry-x28-system-dot-string-x29.md

latest3.8 KB
Original Source

VGridControlBase.SaveLayoutToRegistry(String) Method

SECURITY-RELATED CONSIDERATIONS

Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.

Saves a vertical grid’s layout to a system registry path.

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

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

Declaration

csharp
public virtual void SaveLayoutToRegistry(
    string path
)
vb
Public Overridable Sub SaveLayoutToRegistry(
    path As String
)

Parameters

NameTypeDescription
pathString

A string value which specifies the system registry path to which the layout is saved.

|

Remarks

Use the SaveLayoutToRegistry method to save the grid’s layout to the system registry. You can restore these settings using the VGridControlBase.RestoreLayoutFromRegistry method.

You can define whole and partial registry keys as the parameter. For instance, specifying “Software\MyCompany\MyProject" as a partial key will result in settings being saved to the “HKEY_CURRENT_USER\Software\MyCompany\MyProject" path. You can also specify the entire path if you need to store the layout at another root key. An example is the “HKEY_LOCAL_MACHINE\Software\MyCompany\MyProject" registry path.

Example

The following sample code saves a vertical grid’s layout to the registry and then applies it to a different vertical grid. The VGridControlBase.SaveLayoutToRegistry and VGridControlBase.RestoreLayoutFromRegistry methods are used for this purpose.

The image below shows the result.

csharp
string registryPath = 
"HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\XtraVerticalGrid";
vGridControl1.SaveLayoutToRegistry(registryPath);
vGridControl2.DataSource = vGridControl1.DataSource;
vGridControl2.RestoreLayoutFromRegistry(registryPath);
vb
Dim registryPath As String = _
"HKEY_LOCAL_MACHINE\SOFTWARE\DevExpress Inc\XtraVerticalGrid\"
VGridControl1.SaveLayoutToRegistry(registryPath)
VGridControl2.DataSource = VGridControl1.DataSource
VGridControl2.RestoreLayoutFromRegistry(registryPath)

See Also

SaveLayoutToStream

SaveLayoutToXml

Save and Restore Layouts of DevExpress controls

VGridControlBase Class

VGridControlBase Members

DevExpress.XtraVerticalGrid Namespace