yunzhimu 发表于 2006-5-21 12:21:00

求教,如何获取小数点位数。

本帖最后由 作者 于 2006-5-21 13:16:11 编辑 <br /><br /> <P>RT</P>
<P>如何获取文本框数字的,小数点位数?</P>

yuangw1234 发表于 2006-5-21 20:44:00

<P>不晓得以下程式是否是你想要的,请回复</P>
<P><BR>Public Sub n()<BR>&nbsp;&nbsp;&nbsp; Dim shuz As Double, shuu As Double, weishu As Double<BR>&nbsp;&nbsp;&nbsp; shuz = InputBox("")<BR>&nbsp;&nbsp;&nbsp; shuu = FormatNumber(shuz, 0, vbTrue, vbTrue, vbTrue)<BR>&nbsp;&nbsp;&nbsp; weishu = Len(CStr(shuz)) - Len(CStr(shuu)) - 1<BR>&nbsp;&nbsp;&nbsp; Select Case weishu<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case -1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; weishu = 0<BR>&nbsp;&nbsp;&nbsp; End Select<BR>&nbsp;&nbsp;&nbsp; MsgBox weishu<BR>End Sub<BR></P>

yunzhimu 发表于 2006-5-22 19:17:00

<P>哦,非常感谢!可以用。</P>
页: [1]
查看完整版本: 求教,如何获取小数点位数。