Skip to main content
All docs
V24.2

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

VGridControl.ShowComparison() Method

Displays the selected records in a side-by-side comparison

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.2.dll

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

#Declaration

public bool ShowComparison()

#Returns

Type Description
Boolean

true if the comparison is displayed; otherwise, false

#Remarks

The VGridControl allows you to compare records if the AllowRecordComparison property is set to true.

The ShowComparison method displays the records that were added to the comparison.

To add records to the comparison, use one of the following actions:

#Example

The following example uses the AddToComparison method to add records to the comparison collection, and the ShowComparison method to display the comparison.

using DevExpress.XtraVerticalGrid;

private void btnAddRecordsAndShowComparison_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { 
    // Add records to the comparison collection.
    vGridControl1.AddToComparison(5);
    vGridControl1.AddToComparison(7);
    // Display the comparison.
    vGridControl1.ShowComparison();
}

To get the indices of the records in the comparison, use the GetComparisonRecords method.

The HideComparison method hides the comparison. To clear the comparison collection, use the ClearComparison method.

See Also