99问答网
所有问题
VB中Text控件如何读取txt文本中内容?
比如说我 Form1 窗体上创建一个 Text1 文本框,保存VB文件,在同文件夹下新建一个 1.txt 文档。请问如何让vb中的Text1文本框读取1.txt文档中的内容?
举报该问题
推荐答案 2010-05-21
Private Sub Command1_Click()
Open App.Path & "\1.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, k
Text1 = Text1 & k & Chr(13) & Chr(10)
Loop
Close #1
End Sub
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://99.wendadaohang.com/zd/WBezvzX7W.html
其他回答
第1个回答 2010-05-22
Open App.Path &"\1.txt" For Binary As #1
Text1.Text = Input(LOF(1), 1)
Close 1
第2个回答 2010-05-24
很简单的,这样就可以读取了。
Open App.Path & "\1.txt" For Binary As #1
Text1.Text = Input(LOF(1), 1)
Close #1
相似回答
大家正在搜