vb 读取textbox数据赋值给数组

2024-12-18 20:52:39
推荐回答(2个)
回答1:

二维数组还是一维的,可以用Split来实现
Dim a() As String
Dim b() As String
Dim i As Integer
Dim j As Integer
a = Split(Text1.Text, Chr(13) & Chr(10))
For i = 0 To UBound(a)
b() = Split(a(i), " ")
Next i

回答2:

Private Sub Command1_Click()
Dim a
a = Text1.Text
a = Replace(a, vbCrLf, " ", , , vbBinaryCompare)
a = Split(a, " ")
For i = 0 To UBound(a)
MsgBox a(i)
Next i
End Sub