aa = 3.10234
If Left(Right(aa, 3), 1) <> "." Then
If Left(Right(aa, 2), 1) = "." Then
Label13.caption = Trim(Str(aa)) + "0"
Else
Label13.caption = Trim(Str(aa)) + ".00"
End If
Else
Label13.caption = aa
End If
嘿嘿。。原来还有一种不用程序,用系统东西:
Private Sub Command1_Click()
a = 3.1012
a = FormatNumber(a, 2)
Print a
End Sub
________________________________
FormatNumber($,%)
嘿嘿~我想了一下,不过我老觉得我这样的思想不好!呵!不知道大伙们还有没有别的?
————————————————————————————
Private Sub Command1_Click()
a = 3.10159
i = 2 '小数点位数
a = Round(a, i) 'a=3.1
b = InStr(a, ".") + i - 1
c = b - Len(a) '补0的个数
For i = 0 To c
a = a & "0"
Next
Print a
End Sub
——————————————————————