Skip to main content
All docs
V25.2
  • VGridControl.AddToComparison(Int32[]) Method

    Adds records to the comparison collection.

    Namespace: DevExpress.XtraVerticalGrid

    Assembly: DevExpress.XtraVerticalGrid.v25.2.dll

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

    Declaration

    public bool AddToComparison(
        int[] recordIndices
    )

    Parameters

    Name Type Description
    recordIndices Int32[]

    The indices of the records to be added to the comparison.

    Returns

    Type Description
    Boolean

    true indicates that the records were added successfully to the comparison; otherwise, false.

    Remarks

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

    The AddToComparison method adds records to the comparison collection.

    To display the records that were added to the comparison use the ShowComparison method.

    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 btnAddToComparison_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e){ 
        // Add records to the comparison collection.
        int[] indices = { 2, 3, 5 };
        vGridControl1.AddToComparison(indices);
        // Display the comparison.
        vGridControl1.ShowComparison();
    }
    

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

    To add records to the comparison collection, users can right-click the record header and choose Add to Comparison, or tick the checkbox in the record headers.

    See Also