Select Case e.DataCol.Name
Case "收入_金额","支出_金额"
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("结余") = e.DataRow("收入_金额") - e.DataRow("支出_金额")
dr = e.DataRow
End If
drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey"), "[_SortKey]")
For i As Integer = 1 To drs.Count - 1 '重算余下行的余额
drs(i)("结余") = drs(i-1)("结余") + drs(i)("收入_金额") - drs(i)("支出_金额")
Next
End Select
建个流水表,但总是出错,可能是我使用外部表的原因,请问老师,如果是外部表这段代码如何写呢?
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2020.5.29.8
错误所在事件:表,工会收支,DataColChanged
详细错误信息:
Exception has been thrown by the target of an invocation.
Column '结余' is read only.
[此贴子已经被作者于2021/12/30 21:46:49编辑过]