参考下面的代码,测试有效
Dim tv1 As WinForm.TreeView = Forms("窗口1").Controls("TreeView1")
tv1.Nodes.Clear
Dim nodes As new Dictionary(Of String, WinForm.TreeNode)
For Each u As UserInfo In Users
If u.group IsNot Nothing AndAlso u.Group <> "" Then
If tv1.Nodes.Contains(u.Group) = False Then
Dim n As WinForm.TreeNode = tv1.nodes.Add(u.Group)
nodes.Add(u.Group, n)
End If
nodes(u.Group).nodes.add(u.Name)
End If
Next