参考下面的代码,测试有效。
Dim trv As WinForm.TreeView = Forms("窗口1").Controls("TreeView1")
Dim dt As DataTable = DataTables("表B")
Dim nd As WinForm.TreeNode = Trv.Nodes.Add("目录","目录")
Dim vals As List(Of String) = dt.GetUniqueValues("[第三列] Is Not Null", "第三列")
For Each val As String In vals
Dim md As WinForm.TreeNode = nd.Nodes.Add(val, val)
Dim arys As List(Of String()) = dt.GetUniqueValues("第三列 = '" & val & "'", "第一列", "第二列")
For Each ary() As String In arys
Dim s As String = "【" & ary(0) & "】"
md.Nodes.Add(2 & ary(1), s & ary(1))
Next
Next