Having problems with a list view in VB.net and cant get the groups to work.
Coming in is a datatable with Part number, order number, order qauntity.
I am trying to create groups in the listview to group the orders by part number.
Public Sub PopulateListViewFromDt(ByVal Dt As DataTable)
Dim Dtunique As New DataTable
'Find the unique part number list
If Dt.Rows.Count > 0 Then
Dtunique = Dt.DefaultView.ToTable(True, GroupName)
'Add a group for each item in the unique part number list
For Each row As DataRow In Dtunique.Rows
Dim LVG As New ListViewGroup
.Name = row(GroupName)
.Header = row(GroupName)
'Create the list view item for each item in the datatable.
Dim LVG As ListViewGroup
Dim LVI As New ListViewItem
' I would rather not do this step....I would like to create the group and assign an item to the group, since the group name is known.
For Each Group In ListViewName.Groups
If Group.name = row("PartNumber") Then
LVG = Group
If row(ValidationCriteria) = True Then
.Checked = True
For Each Col In Columns
If Col <> TopItem Then
.Name = row("PartNumber").ToString
.Group = LVG
Thanks for the help in advance, I have read many help topics but I must be missing something.