Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView
Private Sub PopulateItemsCollection(ByVal ordersTable As DataTable)
Dim dataRow As DataRow
Dim dataColumn As DataColumn
' Populate the Items collection from the Rows collection of the 'Orders' table.
For Each dataRow In ordersTable.Rows
' Add an UltraListViewItem for this order, using the value of the
' 'OrderID' field for the item's Value
Dim orderItem As UltraListViewItem = Me.ultraListView1.Items.Add(Nothing, dataRow("OrderID"))
' Set the values for the UltraListViewItem's SubItems. Note that we
' can use an UltraListViewSubItemColumn instance to index into the
' SubItemColumns collection, and use the stored reference to the underlying
' DataColumn to index into the DataRow's columns.
Dim subItemColumn As UltraListViewSubItemColumn
For Each subItemColumn In Me.ultraListView1.SubItemColumns
DataColumn = CType(subItemColumn.Tag, DataColumn)
Dim subItem As UltraListViewSubItem = orderItem.SubItems(subItemColumn)
subItem.Value = dataRow(DataColumn)
' Assign the Appearance we created for this shipper to the
' UltraListViewSubItem's Appearance.
If subItem.Key = "ShipVia" Then subItem.Appearance = Me.ultraListView1.Appearances(subItem.Text)
Next
' Assign the UltraListViewGroup which represents this order's customer
' to the item's Group property.
Dim customerID As String = CType(dataRow("CustomerID"), String)
orderItem.Group = Me.ultraListView1.Groups(customerID)
Next
End Sub