Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Private Sub TraverseAllRowsHelper(ByVal startRow As UltraGridRow, ByRef rowsCount As Integer, ByRef groupByRowsCount As Integer)
Dim row As UltraGridRow = startRow
While Not row Is Nothing
If TypeOf row Is UltraGridGroupByRow Then
' Write code here to process the group by row.
groupByRowsCount += 1
Else
' Write code here to process the regular by row.
rowsCount += 1
End If
' If the row has any child rows, then process them too.
If row.HasChild(False) Then
Me.TraverseAllRowsHelper(row.GetChild(ChildRow.First), rowsCount, groupByRowsCount)
End If
row = row.GetSibling(SiblingRow.Next, True, False)
End While
End Sub
Private Sub Button71_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button71.Click
Dim rowsCount As Integer = 0
Dim groupByRowsCount As Integer = 0
' Get the first row in the UltraGrid.
Dim firstRow As UltraGridRow = Me.ultraGrid1.GetRow(ChildRow.First)
' Call the helper method which is a recursive implmentation for traversing rows.
MessageBox.Show("Please wait. This operation may take a while depending on number of rows.")
Me.TraverseAllRowsHelper(firstRow, rowsCount, groupByRowsCount)
' Show a dialog showing the number of regular rows and number of group-by rows.
MessageBox.Show("The UltraGrid has " & rowsCount & " number of regular rows, and " & groupByRowsCount & " number of group-by rows.")
End Sub