Read a text file in a textbox
By: Lorenzo Dalla Vecchia Date: 21/10/1998

Use this code to read a text file in a textbox. Remember that, if the file exceeds 64K in size, you will get Error 7 (Out of memory).

Open filename for Input as #filenumber
textbox.Text = Input(LOF(filenumber), #filenumber)
Close #
filenumber

filenumber is a free number for the fil filename, and textbox is the textbox to read the file in. Example: to read the file C:\Manual.Txt in the textbox Text1, use this code:

Open "C:\Manual.Txt" For Input As #1 'Open the file
Text1.Text = Input(LOF(1), #1)
      'Read the file
Close #
1
                             'Close the file

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it