Imports System
Imports System.IO
Class Test
Public Shared Sub Main()
'' Create an instance of StreamWriter to write text to a file.
Dim sw As StreamWriter = New StreamWriter("TestFile.txt")
'' Add some text to the file.
sw.Write("This is the ")
sw.WriteLine("header for the file.")
sw.WriteLine("-------------------")
'' Arbitrary objects can also be written to the file.
sw.Write("The date is: ")
sw.WriteLine(DateTime.Now)
sw.Close()
End Sub
End Class
转载请注明出处:
未经允许不得转载:lxfamn » VB.NET 写入文件实例