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

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
st.Close()
For i = 0 To 4
data(i).name = da(i)
data(i).time = dat(i)
Next i
End Sub
我把程序改了一下可运行总是说数组下标越界和索引有问题
能帮忙看一下是怎么回事吗 谢谢了

搜索更多相关主题的帖子: 文件 
2006-10-09 21:03
geney
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-10-9
收藏
得分: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 = str +st.ReadLine()&","
'da = Split(str, ",")
'str2 = st.ReadLine()
'dat = Split(str2, ",")
Next
da=Split(str, ",")
st.Close()
For i = 0 To 4
data(i).name = da(i)
data(i).time = dat(i+1)
Next i
End Sub
2006-10-12 10:18
快速回复:[求助]读取文件程序
数据加载中...
 
   



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

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