Infragistics(R) NetAdvantage(R) Windows Forms
CheckedRows Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraCombo Class : CheckedRows Property

Returns a collection which contains the members of the Rows collection whose CheckStateMember cells equate to a value of true.


Visual Basic (Declaration) 
Public ReadOnly Property CheckedRows As CheckedRowsCollection
public CheckedRowsCollection CheckedRows {get;}


The following code sample demonstrates how to use the CheckedRows collection to determine whether a row with a particular value is checked:

Visual BasicCopy Code
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

    Public Function IsItemChecked(ByVal combo As UltraCombo, ByVal dataValue As Object) As Boolean

        Dim checkedRows As CheckedRowsCollection = combo.CheckedRows

        Dim valueColumn As UltraGridColumn = IIf(combo.DisplayLayout.Bands(0).Columns.Exists(combo.ValueMemberResolved), combo.DisplayLayout.Bands(0).Columns(combo.ValueMemberResolved), Nothing)
        If valueColumn Is Nothing Then Return False

        '  Iterate the CheckedRows collection and compare the value
        '  of each row therein to the specified value.
        Dim row As UltraGridRow
        For Each row In checkedRows

            Dim cellValue As Object = row.Cells(valueColumn).Value

            If Object.Equals(dataValue, cellValue) Then Return True

        Return False

    End Function
C#Copy Code
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

public bool IsItemChecked( UltraCombo combo, object dataValue )
    CheckedRowsCollection checkedRows = combo.CheckedRows;
    UltraGridColumn valueColumn = combo.DisplayLayout.Bands[0].Columns.Exists( combo.ValueMemberResolved ) ? combo.DisplayLayout.Bands[0].Columns[combo.ValueMemberResolved] : null;
    if ( valueColumn == null )
        return false;

    //  Iterate the CheckedRows collection and compare the value
    //  of each row therein to the specified value.
    foreach( UltraGridRow row in checkedRows )
        object cellValue = row.Cells[valueColumn].Value;

        if ( object.Equals(dataValue, cellValue) )
            return true;

    return false;

See Also