我想做到只计算/后面的数字,/前面的不参与计算,怎么改代码,原代码如下:Select Case e.DataCol.Name
Case "累计生产数量"
If e.NewValue Is Nothing Then '如果新值是空白,也就是品名列的内容为空
e.DataRow("累计完成") = Nothing '那么清空此行单价列的内容
Else
Dim mc = System.Text.RegularExpressions.Regex.Matches(e.NewValue , "[0-9\.]+")
Dim sum As Double = 0
For i As Integer = 0 To mc.count-1
output.show(mc(i).value)
sum += val(mc(i).value)
Next
e.DataRow("累计完成") = sum
End If
End Select
谢谢!
Else
Dim sum As Double = 0
dim s1() as string = e.NewValue.replace(vbcr,"").split(vblf)
for each s11 as string in s1
dim s2() as string = s11.split("/")
sum = sum + val(s2(1))
next
e.DataRow("累计完成") = sum
End If
End Select