|
<p>vb text 科学计数</p>
<p><img src="http://img.baidu.com/img/iknow/icn_point.gif"> 悬赏分:0 -</p>
<p>解决时间:2009-12-12 14:36</p>
<p>在text里输入一个比较长的数</p>
<p>执行 text1 = text1 + 1 以后</p>
<p>text里面的数就变成科学计数法显示了</p>
<p>怎么让它禁止显示科学计数法.</p>
<p>提问者: waiwyh0 - 二级</p>
<p>最佳答案</p>
<p>很难处理,要用高精度计算才可以,把数值处理成字符,一位一位从个位开始相加。</p>
<p>做了一个高精度加法运算的</p>
<p>Function jia(ByVal st1 As String, ByVal st2 As String) As String</p>
<p>Dim n1 As Long, n2 As Long, i As Long</p>
<p>Dim n3 As Integer</p>
<p>Dim st3 As String</p>
<p>If IsNumeric(st1) And IsNumeric(st2) Then</p>
<p>If Len(st1) < Len(st2) Then</p>
<p>st3 = st1</p>
<p>st1 = st2</p>
<p>st2 = st3</p>
<p>End If</p>
<p>st3 = ""</p>
<p>n1 = Len(st1)</p>
<p>n2 = Len(st2)</p>
<p>For i = n1 To 1 Step -1</p>
<p>If Len(st3) > 1 Then</p>
<p>n3 = Left(st3, 1)</p>
<p>Else</p>
<p>n3 = 0</p>
<p>End If</p>
<p>If i - n1 + n2 > 0 Then</p>
<p>st3 = Val(Mid(st1, i, 1)) + Val(Mid(st2, i - n1 + n2, 1)) + n3</p>
<p>jia = Right(st3, 1) & jia</p>
<p>Else</p>
<p>st3 = Val(Mid(st1, i, 1)) + n3</p>
<p>jia = Right(st3, 1) & jia</p>
<p>End If</p>
<p>Next</p>
<p>If Len(st3) > 1 Then jia = "1" & jia</p>
<p>Else</p>
<p>jia = "参数错误!"</p>
<p>End If</p>
<p>End Function</p>
<p>0</p>
<p>回答者:</p>
<p>cwa9958 - 十一级 2009-12-6 23:01</p>
<p>我来评论>></p>
|
|