'表B设置DataColChanged事件:
Dim ZHS As List(Of String)
Dim flt1,flt2 As string
Dim n1 As Integer
If e.DataCol.Name = "名称" Then
If e.DataRow.IsNull("名称") Then
e.DataRow("序号") = Nothing
Else
flt1 = "名称 ='" & e.DataRow("名称") & "'"
flt2 = flt1 & " And [_SortKey] <= " & e.DataRow("_SortKey")
ZHS = DataTables("表A").GetValues("序号", flt1)
n1 = e.DataTable.Compute("Count(名称)",flt2)
If n1 <= ZHs.Count Then
e.DataRow("序号") = ZHs(n1-1)
End If
End If
End If