Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

VGridControlBase.SaveLayoutToRegistry(String) Method

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

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.2.dll

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

#Declaration

public virtual void SaveLayoutToRegistry(
    string path
)

#Parameters

Name Type Description
path String

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.

SaveLayoutToXml - method

string registryPath = 
"HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\XtraVerticalGrid";
vGridControl1.SaveLayoutToRegistry(registryPath);
vGridControl2.DataSource = vGridControl1.DataSource;
vGridControl2.RestoreLayoutFromRegistry(registryPath);
See Also