Troy
Well-known member
- Joined
- Feb 7, 2005
- Messages
- 153
- Programming Experience
- 10+
Ok guys I can't see the forest through the trees. *pun intented*
I need to move sModelNumber node under the associated Customer Node I created before. I'm allowing multiple products to be purchased from the same customer and would like the treeview to show not just their name but also in a sub branch below their name the products they've purchased which is in this case is houses and the Modelnumbers for them.
Right now the code places them in the same node level as the client name and I need to bounce it beneath the client name.
In bold is the code I've added that seems to need tweaking. Can you help I'm getting crosseyed.
Dim indx AsShort
Dim currentAlpha AsString
Dim sContactName AsString
Dim sModelNumber AsString
indx = Nothing
currentAlpha = Nothing
sContactName = Nothing
rowCustomer = Nothing
rowProducts = Nothing
'Populate Treeview Control
For indx = Asc("A") To Asc("Z")
I need to move sModelNumber node under the associated Customer Node I created before. I'm allowing multiple products to be purchased from the same customer and would like the treeview to show not just their name but also in a sub branch below their name the products they've purchased which is in this case is houses and the Modelnumbers for them.
Right now the code places them in the same node level as the client name and I need to bounce it beneath the client name.
In bold is the code I've added that seems to need tweaking. Can you help I'm getting crosseyed.

Dim indx AsShort
Dim currentAlpha AsString
Dim sContactName AsString
Dim sModelNumber AsString
indx = Nothing
currentAlpha = Nothing
sContactName = Nothing
rowCustomer = Nothing
rowProducts = Nothing
'Populate Treeview Control
For indx = Asc("A") To Asc("Z")
currentAlpha = Chr(indx)
tvTreeView.Nodes.Add(New TreeNode(currentAlpha))
' Add a child TreeNode for each Author in the matching Main Node.
NextForEach rowCustomer In dt.Rows
Next
If (UCase(Mid(rowCustomer.Item("LastName1"), 1, 1)) = currentAlpha) Then
sContactName = rowCustomer.Item("LastName1") & ", " & rowCustomer.Item("FirstName1") & " " & rowCustomer.Item("MiddleInitial1") & "."
tvTreeView.Nodes(indx - 65).Nodes.Add(sContactName).Tag = rowCustomer.Item("ContactID")
ForEach rowProducts In dt2.Rows
EndIfsModelNumber = rowProducts.Item("ModelNumber")
tvTreeView.Nodes(indx - 65).Nodes.Add(sModelNumber).Tag = rowProducts.Item("ContactID")
Next
Last edited: