Load a file

Option Explicit

Here's some simply code showing you how to load the file test.txt into a text box.

Option Explicit

' Get a free file number
FileNum = FreeFile

' Open Test.txt for input
Open App.Path & "\Test.txt" For Input As FileNum

' Read the contents of the file into TextBox1
TextBox1.Text = Input(Lof(Filenum), FileNum)

' Close the file
Close FileNum

You might also like...

Comments

James Crowley James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audience ...

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook