Private Sub Command1_Click()
Dim t, a() As Integer
t = Split(Text1, ",") '将text1中的内容根据逗号分割成数组
ReDim a(0 To UBound(t))
For i = 0 To UBound(t)
a(i) = Val(t(i)) '将text1中的各个数字赋值给数值数组a
Print a(i);
Next
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode >= Asc("0") And KeyCode <= Asc("9") Then
If Text1 <> "" Then Text1 = Text1 & ","
Text1.SelStart = Len(Text1)
Else
KeyCode = 0
End If
End Sub
if (char !=',')
那么读取
否则 i++
split