Skip to main content
All docs
V26.1
  • VGridControl.AddToComparison(Int32) Method

    Adds a specific record to the comparison collection.

    Namespace: DevExpress.XtraVerticalGrid

    Assembly: DevExpress.XtraVerticalGrid.v26.1.dll

    Declaration

    public bool AddToComparison(
        int recordIndex
    )

    Parameters

    Name Type Description
    recordIndex Int32

    The index of the record to be added to the comparison.

    Returns

    Type Description
    Boolean

    true if the record was added successfully to the comparison; otherwise, false.

    Remarks

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

    The AddToComparison method adds a record 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 btnAddRecordsAndShowComparison_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { 
        // Add records to the comparison collection.
        vGridControl1.AddToComparison(5);
        vGridControl1.AddToComparison(7);
        // Display the comparison.
        vGridControl1.ShowComparison();
    }
    

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

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

    See Also