This Visual Basic Tutorial is all about Saving Text Files.
Writing to a text file is the same as reading a text file but in here, instead of using the StreamReader we will use the StreamWriter which is used to write a stream of text to a file.
- If System.IO.File.Exists("C:\testfile.txt") = True Then
- Dim fWriter As New System.IO.StreamWriter(" C:\testfile.txt")
- MsgBox("The text is written to the file.")
- MsgBox("The .txt file does not exist.")
- End If
Reader might read also: