Imports System
Imports System.IO
Imports System.Text
Public Class Test
Public Shared Sub Main()
Dim path As String = "c:\MyTest.txt"
Dim sw As StreamWriter
Dim createText() As String = {"Hello", "And", "Welcome"}
File.WriteAllLines(path, createText, Encoding.UTF8)
Dim appendText As String = "This is extra text" + Environment.NewLine
File.AppendAllText(path, appendText, Encoding.UTF8)
Dim readText() As String = File.ReadAllLines(path, Encoding.UTF8)
Dim s As String
For Each s In readText
Console.WriteLine(s)
Next
End Sub
End Class
|