37- Saving Text Files

0
395

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.

 

example:
[vb] If System.IO.File.Exists(“C:\testfile.txt”) = True Then

Dim fWriter As New System.IO.StreamWriter(” C:\testfile.txt”)

fWriter.Write(“itsourcode.com”)
fWriter.Close()

MsgBox(“The text is written to the file.”)

Else

MsgBox(“The .txt file does not exist.”)
End If

[/vb]

 

 

Reader might read also:

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.