Results 1 to 3 of 3

Thread: Error Opening Text Files [Resolved]

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60

    Resolved 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:
    1. Private Sub cmdShowOpen_Click()
    2.  
    3. On Error GoTo errHandler
    4.  
    5.     With CommonDialog1
    6.         .Filter = "Text (*.txt)|*.txt"
    7.         .InitDir = "C:\Program Files\My Files"
    8.         .ShowOpen
    9.        
    10.     If Len(.FileName) Then
    11.     Open .FileName For Input As #1
    12.     txtLog.Text = Input$(LOF(1), #1)
    13.     Close #1
    14.     End If
    15.    
    16.     End With
    17.  
    18. Exit Sub
    19. errHandler:
    20.     MsgBox Err.Number & " " & Err.Description
    21.    
    22. 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
  •  



Click Here to Expand Forum to Full Width