VB.NET Programming Examples: Email, Encryption, Zip, HTTP, XML, FTP

Chilkat Software Components

Save String to Utf-8 Text File

Back

VB.NET example code showing how to write a string to a Utf-8 text file.
        ' Write the string as utf-8.
        ' This also writes the 3-byte utf-8 preamble at the beginning of the file.
        Dim appendMode As Boolean = False ' This overwrites the entire file.
        Dim sw As New StreamWriter("out_utf8.txt", appendMode, System.Text.Encoding.UTF8)
        sw.Write(TextBox1.Text)
        sw.Close()