标题:大家给看看,为什么不能提取小数
只看楼主
ankangwr
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2013-4-26
 问题点数:0 回复次数:3 
大家给看看,为什么不能提取小数
示例.rar (1.86 KB)

付上源码,请高手给指点下

Private Sub Command1_Click()
Dim a() As String, i As Integer, max As Integer, min As Integer
 b = Trim(Text1.Text)     
 Do Until InStr(b, "  ") = 0  
 b = Replace(b, "  ", " ")  
 Loop
 a = Split(b, " ")         
 
 max = a(i)
 min = a(i)
For i = LBound(a) To UBound(a) 'i = 1 To UBound(a) '
    If Trim(a(i)) <> "" Then
    If a(i) < min Then min = a(i)
    If a(i) > max Then max = a(i)
    End If
Next i
 Text2 = min
 Text3 = max
End Sub

[ 本帖最后由 ankangwr 于 2013-5-10 16:44 编辑 ]
搜索更多相关主题的帖子: Text2 看看 max 
2013-05-10 16:41
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4912
专家分:29900
注 册:2008-10-15
得分:0 
If val(a(i)) < val(min) Then min = a(i)
    If val(a(i)) > val(max) Then max = a(i)

试试。

授人于鱼,不如授人于渔
早已停用QQ了
2013-05-10 20:26
bczgvip
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:66
帖 子:1310
专家分:5312
注 册:2009-2-26
得分:0 
Dim a() As String, i As Integer, max As double, min As double
补充。
2013-05-11 08:49
ankangwr
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2013-4-26
得分:0 
谢谢了,高手出手,不同凡响呀
2013-05-13 08:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-406746-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.952156 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved