因為工作需要 需要數字無條件進位的程式
上網找到一個函式
數字無條件進位的函數 - 史考特部落格園地
http://www.pro-soho.com/Blog/article.asp?id=58
但是發現些問題存在
數字尾數不能為0會出錯
ex: 1253.5-OK
1523-OK
1520-ERROR
就改寫了一下
改成無條件進位到十位數要改成百位 千位 也簡單
asp.net2.0_VB
'=====e.Row.Cells(I).Text就是數字來源=====
Dim p1 As String
Dim p2 As String
p1 = e.Row.Cells(I).Text
Dim pa = Split(p1, ".")
If Right(pa(0), 1) "0" Then
p2 = CInt(Left(pa(0), Len(pa(0)) - 1)) + 1
p2 = p2 * 10
e.Row.Cells(I).Text = p2
Else
e.Row.Cells(I).Text = pa(0)
End If
全站熱搜
留言列表