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.AddSelectionToComparison() Method

Adds the selected records to the comparison collection.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.2.dll

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

#Declaration

public bool AddSelectionToComparison()

#Returns

Type Description
Boolean

true if the selected records were successfully added to the comparison; otherwise, false.

#Remarks

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

The AddSelectionToComparison method adds the selected group of records to the comparison collection.

To allow multiple record selection, set the MultiSelect property to true.

#Example

The following example code shows how to enable multiple record selection, select records by indices, add the selected records to the comparison collection.

using DevExpress.XtraVerticalGrid;

private void Form1_Load(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
  // Enable multiple record selection.
  vGridControl1.OptionsSelectionAndFocus.MultiSelect = true;
  // Select records with indices 0, 2 and 4.
  vGridControl1.SelectRecord(0);
  vGridControl1.SelectRecord(2);
  vGridControl1.SelectRecord(4);  
  // Add the currently selected records to the comparison.
  vGridControl1.AddSelectionToComparison();
}

Add Selection to Comparison

See Also