Results 1 to 2 of 2

Thread: opening text file

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    Post


    I use the following code to open a file into my richtextbox:

    Private Sub cmdopen_Click()
    Dim filelength

    Open "C:\windows\desktop\document1.txt" For Input As #1

    filelength = LOF(1)

    var1 = Input(filelength, #1)

    Form1.RichTextBox1.Text = var1
    Close #1
    End Sub

    This works fine for small text files. However, the file I want to open is 142k. I keep getting the error: Run time error '62'
    Input past end of file.

    Is there anyway I can resolve this?

    Thanks.


  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670

    Post

    Why not use

    RichTextBox1.Loadfile [filename]



    ------------------
    Mark "Buzby" Beeton
    VB Developer
    [email protected]



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