|
-
Oct 13th, 2004, 03:18 AM
#1
Thread Starter
Member
Error Opening Text Files [Resolved]
Hi, I have a GUI with a button and a textbox. And when I press open, it should open up the text file which I chose. It works fine until I tried to open up a text file with a , on the last line of the text. It will generate an error 62, past end of file. Is there any modifications I can do to my code to solve this problem because most of the textfiles I open have a , at the last line, therefore, if this problem is not solve, my GUI will not serve its purpose. Thanks.
The code for the button is:
VB Code:
Private Sub cmdShowOpen_Click()
On Error GoTo errHandler
With CommonDialog1
.Filter = "Text (*.txt)|*.txt"
.InitDir = "C:\Program Files\My Files"
.ShowOpen
If Len(.FileName) Then
Open .FileName For Input As #1
txtLog.Text = Input$(LOF(1), #1)
Close #1
End If
End With
Exit Sub
errHandler:
MsgBox Err.Number & " " & Err.Description
End Sub
Last edited by iori85z; Oct 13th, 2004 at 03:51 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|