windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrol-b74f3496.md
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
public bool AddSelectionToComparison()
Public Function AddSelectionToComparison As Boolean
| Type | Description |
|---|---|
| Boolean |
true if the selected records were successfully added to the comparison; otherwise, false.
|
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.
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();
}
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
AddSelectionToComparison()