Loading a Specified .txt file to a textbox.

bunze

Well-known member
Joined
Aug 4, 2005
Messages
52
Location
Adirolf
Programming Experience
1-3
In a form load event I want to load a specified .txt file to a textbox.

I don't mean user specified, I want it to be specified by me already in the code.
 
At the very top of the forms code add:
VB.NET:
Imports System.IO

To use the code just add the following to your program:
VB.NET:
 Dim sr As StreamReader = File.OpenText("file_name_here")
textbox1.text = sr.ReadToEnd
 

Latest posts

Back
Top