在VB6.0中,一个Double型变量

来源:百度知道 编辑:UC知道 时间:2024/06/30 09:20:17
在VB6.0中,一个Double型变量的值是0.01,但在TEXT中只显示.01,如何能改过来

format(0.01,"0.00")这样就可以显示了

function NTS(Num as double) as string
dim a,b
if num=0 then NTS="0" :exit function
b=iif(num<0,"-","")
a=str(abs(num))
c1:
if left(a,1)=" " then a=right(a,len(a)-1):goto c1
C2:
if abs(num)<1 then a="0" & a:goto c2
NTS=b & a
end function