VB中把外部的TXT文本内容显示在 VB程序中的TEXT文本框里面怎么做的

如题所述

第1个回答  2013-11-29
Private Sub Command1_Click()
Text1.Text = ""
Dim st As String
Open "d:\f.txt" For Input As #1
Do While Not (EOF(1))
Line Input #1, st
Text1.Text = Text1.Text & st & Chr(13) & Chr(10)
Loop
Close 1
End Sub
文本框里面是我D盘下面f.txt内容。
第2个回答  2013-11-29
dim str as string
dim tem as string
Open "文件路径.txt" For Input As #1
Open t For Output As #2
Do
Line Input #1, tem
str=str & vbcrlf & tem
Loop Until EOF(1)
Close
text1.text=str本回答被网友采纳
相似回答