改成这样
Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView2")
trv1.BuildTree("授权","分组|权限")
For Each u As UserInfo In Users
If u.Group = ""
group = "未分组"
Else
group = u.Group
End If
If u.Type = UserTypeEnum.User Then
If trv2.Nodes.Contains(group) = False Then
trv2.Nodes.Add(group)
End If
trv2.Nodes(group).Nodes.Add(u.Name)
End If
Next
Trv1.Nodes(0).Expand()
trv2.ExpandAll()
[此贴子已经被作者于2014-2-27 22:39:39编辑过]