注册 登录
编程论坛 VB6论坛

大家给看看,为什么不能提取小数

ankangwr 发布于 2013-05-10 16:41, 726 次点击
只有本站会员才能查看附件,请 登录

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

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 编辑 ]
3 回复
#2
风吹过b2013-05-10 20:26
If val(a(i)) < val(min) Then min = a(i)
    If val(a(i)) > val(max) Then max = a(i)

试试。
#3
bczgvip2013-05-11 08:49
Dim a() As String, i As Integer, max As double, min As double
补充。
#4
ankangwr2013-05-13 08:19
谢谢了,高手出手,不同凡响呀
1