Private Sub Command1_Click()
Dim i As Integer, j As Integer, t1 As Integer, t2 As Integer
Dim s As String, c As String, st1 As Integer, st2 As Integer, max As Integer
s = Text1.Text: max = 0: st1 = 1
For i = 1 To Len(s) - 1
c = Mid(s, i, 1)
If c = "," Then
t1 = Val(Mid(s, st1, i - st1))
①
st2 = st1
For j = i + 1 To Len(s)
②
If c = "," Then
t2 = Val(Mid(s, st2, j - st2))
st2 = j + 1
End If
Next j
End If
If j>0 Then t2 = Val(Mid(s, st2, j - st2))
If Abs(t1 - t2) > max Then max = Abs(t1 - t2)
Next i
shuchu.Caption = "所有数之间绝对值相差最大为:" + Str(max)
End Sub
① ②