Free Source Code and Tutorials

Custom Search

37- 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.



  1. If System.IO.File.Exists("C:\testfile.txt") = True Then
  3. Dim fWriter As New System.IO.StreamWriter(" C:\testfile.txt")
  5. fWriter.Write("")
  6. fWriter.Close()
  8. MsgBox("The text is written to the file.")
  10. Else
  12. MsgBox("The .txt file does not exist.")
  13. End If
Facebook Comments
(Visited 1 times, 1 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: