Write text line by line
Option Explicit On
Option Strict On
Imports System
Imports System.IO
Public Class TextToFile
Public Shared Sub Main()
Using sw As StreamWriter = File.CreateText("MyFile.txt")
sw.WriteLine("This is my file.")
sw.WriteLine("I can write ints {0} or floats {1}, and so on.", 1, 4.2)
sw.Close()
End Using
End Sub
End Class
Related examples in the same category