[Select Case e.DataCol.Name
Case "Deposit","Withdrawal"
Dim dr As DataRow
Dim drs As List(of DataRow)
dr = e.DataTable.Find("[_SortKey] < " & e.DataRow("_SortKey"), "[_SortKey] Desc") '找出上一行
If dr Is Nothing Then '如果没有找到上一行,说明本行就是第一行
e.DataRow("Balance") = e.DataRow("Deposit") - e.DataRow("Withdrawal")
dr = e.DataRow
End If
drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey"), "[_SortKey]")
For i As Integer = 1 To drs.Count - 1 '重算余下行的余额
drs(i)("Balance") = drs(i-1)("Balance") + drs(i)("Deposit") - drs(i)("Withdrawal")
Next
End Select
这段代码在DataColsChanged 哪里不对了?
每次修改 deposit 和withdrawal 列都会提示 exception has been thrown by the target of on invocation
[此贴子已经被作者于2020/4/5 12:50:19编辑过]