Dim s1,s2,flt As String
s1 = "主管司法局|法律服务所|姓名"
Dim v1() As String=s1.split("|")
Dim dt As DataTable
Dim b As New GroupTableBuilder("统计表1",DataTables("基层法律服务人员信息表"))
b.Groups.AddDef(v1(0))
b.Groups.AddDef(v1(1))
b.Groups.AddDef(v1(2))
dt = b.Build(False)
Dim trv As WinForm.TreeView = Forms("窗口2").Controls("TreeView1")
'trv.Nodes.Clear
trv.BuildTree(dt,s1)
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Select Case nd.Level
Case 0,1
flt = v1(0) & " ='" & nd .FullName.replace("\", "' and " & v1(1) & " = '") & "'"
nd.Text = nd.text & "(" & dt.Compute("count(姓名)",flt) & "人)"
End Select
Next
trv.Nodes.Insert("全部","全部(" & dt.Compute("count(姓名)") & "人)",0)
trv.ResumeRedraw