Mega Code Archive

 
Categories / VB.Net / File Directory
 

Use StreamWriter to write text to a file

Imports System Imports System.IO Class Test     Public Shared Sub Main()         Using sw As StreamWriter = New StreamWriter("TestFile.txt")             sw.Write("This is the ")             sw.WriteLine("header for the file.")             sw.Write("The date is: ")             sw.WriteLine(DateTime.Now)             sw.Close()         End Using     End Sub End Class