Private Sub Command1_Click()
Text5.Text =(Text1.Text)* (Text2.Text) * (Text3.Text) * (Text4.Text)) / 2
End Sub
不知道怎么修改才能把.x显示成0.x
我想要完整的代码 因为我是刚学VB 不会修改
问题补充:大于1的数前面不多零
VB小数显示问题
答案:4 悬赏:40 手机版
解决时间 2021-02-27 21:49
- 提问者网友:雾里闻花香
- 2021-02-27 00:00
最佳答案
- 五星知识达人网友:独钓一江月
- 2021-02-27 01:12
Private Sub Command1_Click()
Text5.Text = Str(Val(Text1.Text) * Val(Text2.Text) * Val(Text3.Text) * Val(Text4.Text)) / 2
if abs(text5)<1 and text5<>0 then
if text5>0 then
text5="0" & trim(text5)
else
text5="-0" & trim(abs(text5))
end if
end if
End Sub
Text5.Text = Str(Val(Text1.Text) * Val(Text2.Text) * Val(Text3.Text) * Val(Text4.Text)) / 2
if abs(text5)<1 and text5<>0 then
if text5>0 then
text5="0" & trim(text5)
else
text5="-0" & trim(abs(text5))
end if
end if
End Sub
全部回答
- 1楼网友:不如潦草
- 2021-02-27 04:01
Text5.Text =(Text1.Text)* (Text2.Text) * (Text3.Text) * (Text4.Text)) / 2
你可以先把它转换成文字再加“0”
如:
A$=str$(Text1.Text)* (Text2.Text) * (Text3.Text) * (Text4.Text)) / 2 )
A$="0"+A$
Text5.Text=A$
- 2楼网友:白昼之月
- 2021-02-27 02:55
大哥,我头都大了,给你的那段代码不能用吗?
如果不能用你也说一声啊。
这段代码在我写的某一个项目中正在使用。
function strnum(i as single) as string
if abs(i)<1 and i<>0 then
if i>0 then
strnum="0" & trim(i)
else
strnum="-0" & trim(abs(i))
end if
end if
end function
- 3楼网友:醉吻情书
- 2021-02-27 02:24
vb6 用 single单精度
double 双精度
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯