Mega Code Archive

 
Categories / VB.Net Tutorial / Stream File
 

Save UTF8Encoding string to text file

Imports System.IO Imports System.Text public class Test    public Shared Sub Main         Dim file_stream As New FileStream("test.txt", FileMode.Create)         Dim bytes As Byte() = New UTF8Encoding().GetBytes("Hello world!")         file_stream.Write(bytes, 0, bytes.Length)         file_stream.Close()    End Sub End class