For Each dc As DataCol In DataTables("预算报表_table1").DataCols
If dc.name = "预算类型" Then
Continue For
Else Dim r0 As Row = Tables("预算报表_table1").Rows(0)
Dim r1 As Row = Tables("预算报表_table1").Rows(1)
Dim r2 As Row = Tables("预算报表_table1").Rows(2)
r0(dc.name) = r1(dc.name) - r2(dc.name)
End If
Next
减号报错,加号正常运算,为啥?
报错提示“从字符串“”到类型“double”的转换无效”
我的意思是原来没有
If dc.name = "预算类型" Then Continue For
这一段代码的时候,我看到加号是把字符合并了,所有加了这各代码,后面就正常运算了。不会出现字符相加的意思,但是减号不能达到这个效果
剩下的还有字符列吗
For Each dc As DataCol In DataTables("预算报表_table1").DataCols
If dc.name = "预算类型" Then
Continue For
Else
Dim r0 As Row = Tables("预算报表_table1").Rows(0) 这一句必须换行,不能和Else 同一行
Dim r1 As Row = Tables("预算报表_table1").Rows(1)
Dim r2 As Row = Tables("预算报表_table1").Rows(2)
r0(dc.name) = r1(dc.name) - r2(dc.name)
End If
Next