vb中如何将txt文件中的两列数据读入listbox
数据格式:1023202730354040如何将两列数据分别读入两个listbox?PrivateSubCommand1_Click()Open"d:/1.txt"For...
数据格式:
10 23
20 27
30 35
40 40
如何将两列数据分别读入两个listbox?
Private Sub Command1_Click()
Open "d:/1.txt" For Input As #1
Do Until EOF(1)
Line Input #1, s
arr = Split(Trim(s), " ")
List1.AddItem arr(0)
List2.AddItem arr(1)
Loop
Close #1
End Sub
我把s声明为string,运行时虽然输入数据,但是提示arr(0)下标越界 展开
10 23
20 27
30 35
40 40
如何将两列数据分别读入两个listbox?
Private Sub Command1_Click()
Open "d:/1.txt" For Input As #1
Do Until EOF(1)
Line Input #1, s
arr = Split(Trim(s), " ")
List1.AddItem arr(0)
List2.AddItem arr(1)
Loop
Close #1
End Sub
我把s声明为string,运行时虽然输入数据,但是提示arr(0)下标越界 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询