Private Function ReadTextFile(ByVal strFileLocation As String) As String Dim srReader As New System.IO.StreamReader(strFileLocation) Dim strContent As String = srReader.ReadToEnd srReader.Close() Return strContent End Function
Usuage
SomeObject = ReadTextFile("Location of Text File") TextBox1.Text = ReadTextFile("C:\Desktop\File.txt")