Text1.Text = Round(0.1245, 3)  结果为0.124
Text1.Text = Round(0.1255, 3)  结果为0.126
为什么啊,奇进偶不进
还有什么函数能够表示四舍五入

解决方案 »

  1.   

    前几天有人提过这样的问题
    用format
      

  2.   

    Format$(15.1245,"0.000") = 15.125
    Format$(15.1255,"0.000") = 15.126
      

  3.   

    那要用多少个if语句阿,小数位数是不确定的,并且前面还有可能有< > 等
      

  4.   

    VB的round函数并不准确,你需要修改一下。
    下面是我的改进后的代码:
    Public Function myRound(nNumber, Optional nDec As Long = 0)
        myRound = Round(nNumber + 0.1 ^ (nDec + 1), nDec)
    End Function
      

  5.   

    Function MyFormat(ByVal n#, ByVal m&) As String
        
        If (m > 0) Then
            MyFormat = Format$(n, "0." & String(m, "0"))
        Else
            MyFormat = Format$(n, "0")
        End IfEnd Function............