这个意思?DataCochanged事件
Select Case e.DataCol.Name
Case "生产计划id", "本车数量"
Dim drs As List(of DataRow)
Dim Filter As String
Filter = "[_SortKey] >= " & e.DataRow("_SortKey") & " And [生产计划id] = '" & e.DataRow("生产计划id") & "'"
drs = e.DataTable.Select(Filter)
For Each dr As DataRow In drs
Filter = "[_SortKey] <= " & dr("_SortKey") & " And [生产计划id] = '" & dr("生产计划id") & "'"
Dim Val1 As Double = e.DataTable.Compute("Sum(本车数量)",Filter)
dr("累计数量") = Val1
Next
If e.DataCol.Name = "生产计划id" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
Filter = "[_SortKey] > " & e.DataRow("_SortKey") & " And [生产计划id] = '" & e.OldValue & "'"
drs = e.DataTable.Select(Filter)
For Each dr As DataRow In drs
Filter = "[_SortKey] <= " & dr("_SortKey") & " And [生产计划id] = '" & dr("生产计划id") & "'"
Dim Val1 As Double = e.DataTable.Compute("Sum(本车数量)",Filter)
dr("累计数量") = Val1
Next
End If
End Select