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

rowTypes
Whether to get data rows or group-by rows or both.
bandToMatch
If this parameter is non-null then rows from only this band will be returned. If it is null, then rows from all bands will be returned.
lowestLevelBand
If this parameter is non-null then rows from bands upto the lowestLevelBand (inclusive) will be returned. If bandToMatch is specified as non-null then this will be ignored.
Gets the rows associated with this rows collection as well as descendant row collections upto the lowestLevelBand.

Syntax

Visual Basic (Declaration) 
Public Function GetRowEnumerator( _
   ByVal rowTypes As GridRowType, _
   ByVal bandToMatch As UltraGridBand, _
   ByVal lowestLevelBand As UltraGridBand _
) As IEnumerable
C# 
public IEnumerable GetRowEnumerator( 
   GridRowType rowTypes,
   UltraGridBand bandToMatch,
   UltraGridBand lowestLevelBand
)

Parameters

rowTypes
Whether to get data rows or group-by rows or both.
bandToMatch
If this parameter is non-null then rows from only this band will be returned. If it is null, then rows from all bands will be returned.
lowestLevelBand
If this parameter is non-null then rows from bands upto the lowestLevelBand (inclusive) will be returned. If bandToMatch is specified as non-null then this will be ignored.

Return Value

Returns an IEnumerable instance that can be used to enumerate the rows. Note that you can use a for each loop to traverse the rows.

Example

The following code will get an enumerator that will loop through every row in the grid on every level of the hierarchy including GroupBy rows.

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

' Row Types indicates which types of rows are enumerated: Data rows, GroupBy rows, or both. 
' In this case, return both. 
Dim rowTypes As GridRowType = GridRowType.DataRow Or GridRowType.GroupByRow

' Get a Row Enumerator that will return all rows in the entire grid.
' This includes all rows in the root band as well as all child bands down
' to the lowest level. 
Dim enumerator As IEnumerable = Me.ultraGrid1.Rows.GetRowEnumerator(rowTypes, Nothing, Nothing)
Dim row As UltraGridRow
For Each row In enumerator
    ' Since this enumerator can return Data rows or GroupBy rows, 
    ' check IsGroupByRow to determine which one we are dealing with.
    If (row.IsGroupByRow) Then
Debug.WriteLine(row.Description)
    Else
Debug.WriteLine(row.Cells(0).Value)
    End If
Next
C#Copy Code
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;

// Row Types indicates which types of rows are enumerated: Data rows, GroupBy rows, or both. 
// In this case, return both. 
GridRowType rowTypes = GridRowType.DataRow | GridRowType.GroupByRow;

// Get a Row Enumerator that will return all rows in the entire grid.
// This includes all rows in the root band as well as all child bands down
// to the lowest level. 
IEnumerable enumerator = this.ultraGrid1.Rows.GetRowEnumerator(rowTypes, null, null);
foreach (UltraGridRow row in enumerator)
{
	// Since this enumerator can return Data rows or GroupBy rows, 
	// check IsGroupByRow to determine which one we are dealing with.
	if (row.IsGroupByRow)
		Debug.WriteLine(row.Description);
	else
		Debug.WriteLine(row.Cells[0].Value);
}

Remarks

See Also