表B的DataColChanged事件 中设置如下代码:
If e.DataCol.Name = "调度单号" Then
if e.datarow.isnull("调度单号") then
e.DataRow("商品车") = nothing
else
Dim g As New GroupTableBuilder("统计表1", DataTables("表A"))
g.Groups.AddDef("商品车")
g.Totals.AddDef("台数")
g.filter = "调度单号='" & e.newvalue & "'"
dim dt as datatable = g.Build(true)
dim s as string = ""
for each dr as datarow in dt.datarows
s = s & "," & dr("商品车") & dr("台数") & "台"
next
e.DataRow("商品车") = s.trim(",")
end if
End If