Skip to main content
All docs
V24.1

VGridControl.AddSelectionToComparison() Method

Adds the selected records to the comparison collection.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.1.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