LoadTextFile – Load the contents of a text file

' Returns the content of the specified text file' Note: it can throw an exception' Usage: Dim FileContent As String = LoadTextFile("C:Autoexec.bat")Function LoadTextFile(ByVal FilePath As String) As String    Dim sr As System.IO.StreamReader    Try        sr = New System.IO.StreamReader(FilePath)        LoadTextFile = sr.ReadToEnd()    Finally        If Not sr Is Nothing Then sr.Close()    End TryEnd Function

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: