Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics
   Private Sub Button16_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button16.Click
       ' IsGroupByColumn indicates if the column is a group-by column. Group-by columns are
       ' the columns that rows are grouped by.
       ' Enable Outlook GroupBy functionality by setting the view style to OutlookGroupBy.
       ' This will show a group-by-box that the user can drag columns into to group row by 
       ' those columns.
       Me.ultraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy
       Dim band As UltraGridBand = Me.ultraGrid1.DisplayLayout.Bands(0)
       ' Group rows by Country column.
       band.SortedColumns.Add("Country", False, True)
       ' Loop through all the columns and print out the keys of the columns that are 
       ' group-by columns. It should print out Country column since we just made it a
       ' group-by column above.
       Dim i As Integer
       For i = 0 To band.Columns.Count - 1
           If band.Columns(i).IsGroupByColumn Then
               Debug.WriteLine(band.Columns(i).Key & " is a group-by column.")
           End If
       Next
   End Sub