首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

有关文件的逐行存储,该怎么解决

2012-01-31 
有关文件的逐行存储我现在要读一个文件,用一个数组存储文件的每一行,即a(0)存第一行,a(1)存第二行...怎么

有关文件的逐行存储
我现在要读一个文件,用一个数组存储文件的每一行,即a(0)存第一行,a(1)存第二行...怎么操作?

[解决办法]
Dim fsoTxt As New FileSystemObject, tsTxt As TextStream
Dim i As Integer
Dim J As Integer

Set tsTxt = fsoTxt.OpenTextFile(AppfileName, ForReading)
tsTxt.ReadAll
J = tsTxt.Line
tsTxt.Close

Set tsTxt = fsoTxt.OpenTextFile(AppfileName, ForReading)
For i = 0 To J - 1
a(i) = tsTxt.ReadLine
Next

tsTxt.Close

热点排行