windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrolbase-dot-savelayouttoregistry-x28-system-dot-string-x29.md
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
public virtual void SaveLayoutToRegistry(
string path
)
Public Overridable Sub SaveLayoutToRegistry(
path As String
)
| Name | Type | Description |
|---|---|---|
| path | String |
A string value which specifies the system registry path to which the layout is saved.
|
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.
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.
string registryPath =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\XtraVerticalGrid";
vGridControl1.SaveLayoutToRegistry(registryPath);
vGridControl2.DataSource = vGridControl1.DataSource;
vGridControl2.RestoreLayoutFromRegistry(registryPath);
Dim registryPath As String = _
"HKEY_LOCAL_MACHINE\SOFTWARE\DevExpress Inc\XtraVerticalGrid\"
VGridControl1.SaveLayoutToRegistry(registryPath)
VGridControl2.DataSource = VGridControl1.DataSource
VGridControl2.RestoreLayoutFromRegistry(registryPath)
See Also