i_sourcecode 2013年09月10日
vb未知文本框内容数量,怎么将文本框内容赋值给变量?数组分割后存入变量的方法
问题请教下各位,文本框的坐标文本,
例如:111,222回车333,444回车555,666,这样的格式不确定有多少组
怎样才能不下标越界,请教高手优化代码,或给方法,我是新手,请大家多多关照
Private Sub Command1_Click()
Dim linestring() As String
Dim temp1() As String
Dim temp2() As String
Dim temp3() As String
Dim temp4() As String
Dim temp5() As String

linestring = Split(Text1.Text, Chr(13))
temp1() = Split(linestring(0), ",")
temp2() = Split(linestring(1), ",")
temp3() = Split(linestring(2), ",")
temp4() = Split(linestring(3), ",")
temp5() = Split(linestring(4), ",")
For i = 0 To UBound(temp1)
Print "数组1的第" & i + 1 & "项是: " & temp1(i)
Print "数组2的第" & i + 1 & "项是: " & temp2(i)
Print "数组3的第" & i + 1 & "项是: " & temp3(i)
Print "数组4的第" & i + 1 & "项是: " & temp4(i)
Print "数组5的第" & i + 1 & "项是: " & temp5(i)
Next i
End Sub
...全文
67 点赞 收藏 1
写回复
1 条回复

还没有回复,快来抢沙发~

发动态
发帖子
VB基础类
创建于2007-09-28

2738

社区成员

19.7w+

社区内容

VB 基础类
社区公告
暂无公告