Jaruzel.com

Write Text to a Text File with Stream Writer


'Write to text file with the Stream Writer Class
Dim sWriter As IO.StreamWriter = New IO.StreamWriter("c:\newTextFile.txt")

'This is pretty much easy to understand. No explanation
sWriter.WriteLine("Hi")
sWriter.WriteLine("Testing out this code")
sWriter.WriteLine("Hopefully this code will work")
sWriter.WriteLine("Lets flush the stream and see")
'Put the data inside the text file
sWriter.Flush()