Dim dt As DataTable
Dim b As New GroupTableBuilder("统计表1",DataTables("松北所居委会信息汇总表"))
b.Groups.AddDef("街道")
b.Groups.AddDef("居委")
b.Totals.AddDef("居委",AggregateEnum.Count,"居委数") \'根据居委列来统计居委数
dt = b.Build(True)
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "街道|居委")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim jd As String = nd.DataRow("街道")
Select Case nd.Level
Case 0
nd.Text = nd.text & "(" & nd.DataRow("居委数") & "个)"
End Select
Next
trv.Nodes.Insert("加载所有数据","加载所有数据(" & dt.Compute("Sum(居委数)") & "个)",0)
trv.ResumeRedraw