Back to Devexpress

VGridControl.AddSelectionToComparison() Method

windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrol-b74f3496.md

latest3.8 KB
Original Source

VGridControl.AddSelectionToComparison() Method

Adds the selected records to the comparison collection.

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

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

Declaration

csharp
public bool AddSelectionToComparison()
vb
Public Function AddSelectionToComparison As Boolean

Returns

TypeDescription
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.

csharp
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();
}
vb
Imports DevExpress.XtraVerticalGrid

Private Sub Form1_Load(ByVal sender As Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs)
  ' 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()
End Sub

See Also

AllowRecordComparison

AddToComparison(Int32)

AddSelectionToComparison()

RemoveFromComparison(Int32)

ShowComparison()

HideComparison()

ClearComparison()

GetComparisonRecords()

VGridControl Class

VGridControl Members

DevExpress.XtraVerticalGrid Namespace