vb 读取textbox数据赋值给数组
数据17.8-17.888.129.8-29.890.133.8-43.8104.145.8-45.8106.139.9-39.9100.2每行回车结束数据之间8个空格每...
数据
17.8 -17.8 88.1
29.8 -29.8 90.1
33.8 -43.8 104.1
45.8 -45.8 106.1
39.9 -39.9 100.2
每行回车结束
数据之间8个空格
每读取一行数据就赋值给数组a(0)=17.8,a(1)=-17.8,a(2)=88.1 输出数组
然后读下一行数据!~赋值给 a(0),a(1),a(2)输出,直到行结束
用循环怎么做啊? 展开
17.8 -17.8 88.1
29.8 -29.8 90.1
33.8 -43.8 104.1
45.8 -45.8 106.1
39.9 -39.9 100.2
每行回车结束
数据之间8个空格
每读取一行数据就赋值给数组a(0)=17.8,a(1)=-17.8,a(2)=88.1 输出数组
然后读下一行数据!~赋值给 a(0),a(1),a(2)输出,直到行结束
用循环怎么做啊? 展开
展开全部
二维数组还是一维的,可以用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
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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
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
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
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询