# 多次列印资料到TextBox中出问题(急!!!)

Posted by Richard on August 07, 1998 at 00:53:49:

各位VB高手,请帮忙:
小弟在写一个Serch(搜寻)的充实程式,主要是将某个目录下的所有档案中包含指定的字篡(String)
,便将此档案内容放到TextBox中,以便阅读,然后再按Continue_Key继续开档搜寻再放到TextBox,如此
重复,第一次顺利可以在TextBox中读到档案内容,但第二次就发生"Run-Time Error:62
Input Past End of File", 我是用"Text3.Text = Input$(LOF(4), 4)"方式放入TextBox,请教
各位VB高手,请指点小弟是那里错误,谢谢!
程式部分:
Sub Srchstr()
posv = -1
For i = k To n
k = k + 1
f = 0
Open files(i) For Input As #3
While Not EOF(3)
Line Input #3, allstr
posv = InStr(1, allstr, srch, 1)
If posv <> -1 Then
f = 1
GoTo ll1
End If
Wend
ll1:
Close #3
If f = 1 Then
Command3.Enabled = True
Open files(i) For Input As #4
Text3.Refresh
ll = LOF(4)
Text3.Text = Input$(LOF(4), 4)
i = n + 1
Close #4
End If
Next i
If k >= n Then
Text3.Text = "Finish"
End If
End Sub

Private Sub Command2_Click()
Dim srch As String
srch = Text2.Text
End Sub

Private Sub Command3_Click()
i = k
files(i) = Text1.Text + "\" + files(i)
Call Srchstr
End Sub

Follow Ups: