Accessing the File System
Reading to and writing from custom files is a lot less common than it used to be, but if you need to read and write text files, My makes it easy to do. Listing 7 writes to and reads from a text file named test.txt.
Listing 7 Write to and read from a text file.
Sub ReadWriteFile() My.Computer.FileSystem.WriteAllText("c:\temp\test.txt", "This is some text", False) Dim s As String = My.Computer.FileSystem.ReadAllText("c:\temp\test.txt") Console.WriteLine("Wrote and read: " & s) End Sub