冯小刚张国立哪里人:VB逐行读入文本内容

来源:百度文库 编辑:高校问答 时间:2024/05/04 07:32:40
现有一个文本文档C:\123.txt,有两行内容
AA
BB

想把第一行内容AA读入程序的Text1中,把第二行的内容BB读入Text2。
程序应该怎么写?

谢谢
还是没有效果,两个Textbox都没有变化。。
麻烦大家测试一下好么?谢谢

要用Line Input 来实现行读入

Open "c:\123.txt" For Input As #1
Line Input #1, nextline \'1行读入
Text1.Text = nextline
Line Input #1, nextline \'2行读入
Text2.Text = nextline
Close #1

dim a as string
dim b as string
open "c:\123.txt" for input as #1
input #1 , a
text1.text = a
input #1 , b
text2.text = b
close #1

没测试过,随手写写