vb读取txt内容为变量~2

来源:百度知道 编辑:UC知道 时间:2024/05/29 15:07:31

Dim TextLine
Open app.path & "\aa.txt" For Input As #1 ' 打开文件。
Do While Not EOF(1) ' 循环至文件尾。
Line Input #1, TextLine ' 读入一行数据并将其赋予某变量,这里是赋给了TEXTLINE
if a= TextLine then' 把读入的文本与A核对
Line Input #1, TextLine '读入下一行
print textline '在窗体上显示这一行
end if
Loop
Close #1 ' 关闭文件。