|

VB.NET Programming Examples: Email, Encryption, Zip, HTTP, XML, FTP
Chilkat Software Components
Write Strings to File
Back
VB.NET sample code showing how to write strings to a file.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim sw As New StreamWriter("myText.txt")
' Write ANSI strings to the file line by line...
sw.Write("Hello ")
sw.WriteLine("World!")
' WriteLine writes a CRLF at the end of each line.
sw.WriteLine("This is the 2nd text line!")
' ...
sw.Close()
End Sub
|