以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  数据类型为“字符”的列中怎么将DataColChanged事件算出来的值保留3位小数?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=117104)

--  作者:vxzx
--  发布时间:2018/4/6 16:34:00
--  数据类型为“字符”的列中怎么将DataColChanged事件算出来的值保留3位小数?
If e.DataRow.IsNull("尺寸偏差_标准尺寸_长度_厘米") Then
    e.DataRow("尺寸偏差_偏差_长度") = Nothing
Else
    If e.DataRow.IsNull("尺寸偏差_到货尺寸_长度_厘米") Then
        e.DataRow("尺寸偏差_偏差_长度") = Nothing
    Else
        e.DataRow("尺寸偏差_偏差_长度") = (e.DataRow("尺寸偏差_到货尺寸_长度_厘米") - e.DataRow("尺寸偏差_标准尺寸_长度_厘米"))/e.DataRow("尺寸偏差_标准尺寸_长度_厘米")*100
    End If
End If


--  作者:有点甜
--  发布时间:2018/4/6 17:26:00
--  
If e.DataRow.IsNull("尺寸偏差_标准尺寸_长度_厘米") Then
    e.DataRow("尺寸偏差_偏差_长度") = Nothing
Else
    If e.DataRow.IsNull("尺寸偏差_到货尺寸_长度_厘米") Then
        e.DataRow("尺寸偏差_偏差_长度") = Nothing
    Else
        e.DataRow("尺寸偏差_偏差_长度") = Format((e.DataRow("尺寸偏差_到货尺寸_长度_厘米") - e.DataRow("尺寸偏差_标准尺寸_长度_厘米"))/e.DataRow("尺寸偏差_标准尺寸_长度_厘米")*100, "0.000")
    End If
End If