vb 打开txt文件并显示在一个文本框中

Private Sub File1_Click()
Dim st As String, fpath As String
Text1.Text = ""
If Right(Dir1.Path, 1) = "\" Then
fpath$ = Dir1.Path & File1.FileName
Else
fpath$ = Dir1.Path & "\" & File1.FileName
End If
Open fpath For Input As #1'个人怀疑这儿错了 但不知道怎么改
Do While EOF(1) '一直执行直到读到文件末尾
Line Input #1, st '每次读取一个整行
Text1.Text = Text1.Text + st + vbCrLf
Loop
Close #1
End Sub

第1个回答  2010-05-23
你说的那里没错,但下一行应该是
Do while not EOF(1)本回答被提问者采纳
第2个回答  2010-05-23
没错啊,你用这个代码有啥问题?
相似回答