如图最后一列,相关会计科目取值加减,要如何设计?
Dim Value As String = dr("表达式") '表达式这里只能有数字+-,不能有别的符号
Dim sps() As Char = {"+","-"}
Dim Names() As String = Value.Split(sps)
For Each name As String In Names
Dim tr1 As DataRow =DataTables("余额表").sqlFind(列名 = NAME)
If tr1 IsNot Nothing Then
begsuma = begsuma + tr1("期初金额")
End If
next
如果每个值都相加,可以A =A +值。但是如果有减法,该如何修改?
参考:
http://www.foxtable.com/webhelp/topics/1277.htm
Dim Value As String = dr("表达式")
begsuma = eval(Value )