For the record, this is the code that populates the tree. It uses a recursive subroutine so it can drill into inifinte layers
Private Sub Button1_Click_8(sender As Object, e As EventArgs) Handles Button1.Click
Dim y() As AdvancedHMI.Drivers.CLXTag = EthernetIPforCLXCom1.GetTagList
For i = 0 To y.Length - 1
Dim Node As New TreeNode(y(i).TagName)
TreeView1.Nodes.Add(Node)
AddSubNode(Node, y(i).UDTStructure)
Next
End Sub
Private Sub AddSubNode(node As TreeNode, UDTstructure As AdvancedHMI.Drivers.CIP.CLXTemplateObject)
If UDTstructure IsNot Nothing Then
For i = 0 To UDTstructure.Members.Count - 1
Dim SubNode As New TreeNode(UDTstructure.Members(i).Name)
node.Nodes.Add(SubNode)
AddSubNode(SubNode, UDTstructure.Members(i).SubTemplate)
If UDTstructure.Members(i).SubTemplate IsNot Nothing Then
SubNode.Text &= " (" & UDTstructure.Members(i).SubTemplate.Name & ")"
End If
Next
End If
End Sub