DD in AK (1) [Avatar] Offline
#1
I'm trying to use Group By to populate a TreeView. The following nested query works fine, however, I'm not able to get similar results using the VB version of Listing422.

Dim Listing421 = From publisher In SampleData.Publishers
Select New With {.Publishers = publisher.Name,
.Books = (From book In SampleData.Books
Where book.Publisher.Name = publisher.Name)}

Dim CurrentNode As TreeNode
For Each item In Listing421
CurrentNode = TreeView1.Nodes.Add(item.Publishers)
For Each subitem In item.Books
CurrentNode.Nodes.Add(subitem.Title)
Next
Next

Dim Listing422 = From book In SampleData.Books
Group book By publisher = book.Publisher
Into publisherBooks = Group
Select New With {.Publisher = publisher.Name, .Books = publisherBooks}

'TreeView code ...