| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 522 人关注过本帖
标题:[求助]数组索引超出下标问题
只看楼主 加入收藏
JIANGYANG
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-10-8
收藏
 问题点数:0 回复次数:3 
[求助]数组索引超出下标问题

Public Structure jilu
Dim name As String
Dim time As String
End Structure
Public data(6) As jilu
Sub ReadDat()
Dim st As IO.StreamReader = New IO.StreamReader("E:\xiangmulianxi\pintulianxi\Writer.txt")
Dim i As Integer
Dim str, str2 As String
Dim da(0), dat(0) As String

For i = 0 To 4
str = st.ReadLine()
da = Split(str, ",")
str2 = st.ReadLine()
dat = Split(str2, ",")
Next
For i = 0 To 4
data(i).name = da(i)
data(i).time = dat(i)
Next i
End Sub
运行时总是在data(i).name=da(i)报错,说数组索引超出下标
拜托各位帮忙看一下 哪里有问题

搜索更多相关主题的帖子: 索引 
2006-10-09 15:40
chenjin145
Rank: 1
等 级:禁止访问
帖 子:3922
专家分:0
注 册:2006-7-12
收藏
得分:0 
Dim da, dat As String()

[url=javascript:alert(1);] [div]fdgfdgfdg\" on\"[/div] [/url]
2006-10-09 16:04
蓝の魂
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2006-9-22
收藏
得分:0 

Public Structure jilu
Dim name As String
Dim time As String
End Structure
Public data(6) As jilu
Sub ReadDat()
Dim st As IO.StreamReader = New IO.StreamReader("E:\xiangmulianxi\pintulianxi\Writer.txt")
Dim i As Integer
Dim str, str2 As String
Dim da(), dat() As String

For i = 0 To 4
str = st.ReadLine()
da = Split(str, ",")
str2 = st.ReadLine()
dat = Split(str2, ",")
Next
For i = 0 To 4
data(i).name = da(i)
data(i).time = dat(i)
Next i
End Sub

对VB.net感兴趣的请加入15636854讨论群

[此贴子已经被作者于2006-10-10 19:54:32编辑过]

2006-10-10 19:54
wfscyl
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2006-10-3
收藏
得分:0 
Dim da(), dat() As String
2006-10-12 11:33
快速回复:[求助]数组索引超出下标问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023670 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved