LocationMy.Computer.FileSystem.ReadAllText SyntaxDim result As String = My.Computer.FileSystem.ReadAllText( _ path[, encoding])
DescriptionThe ReadAllText method returns the entire contents of a text file as a String. For information on code pages and encoding, see the System.Text.Encoding entry in the documentation supplied with the .NET Framework. Usage at a Glance
ExampleThe following example reads in the contents of a file. Dim errorText As String errorText = My.Computer.FileSystem.ReadAllText("C:\error.log") If (Len(Trim(errorText)) <> 0) Then _ MsgBox("The following error was recorded:" & vbCrLf & _ vbCrLf & errorText) Related Framework Entries
See AlsoFileSystem Object, OpenTextFieldParser Method, OpenTextFileReader Method, OpenTextFileWriter Method, ReadAllBytes Method, WriteAllBytes Method, WriteAllText Method |