writing lines in text file

tahu191

Well-known member
Joined
Oct 27, 2005
Messages
48
Location
USA
Programming Experience
Beginner
I sort of get the basic idea of this but I need help. I need to write to the end of the text file that already exists. Alright, thanks for all the help.
 
Example:

VB.NET:
Imports System
Imports System.IO

 
Class TestLogFile
 
    Public Shared Sub Main ()
 
        Dim sw As StreamWriter
 
        Try 
            ' Open for appending
            sw = File.AppendText("prog.log")
 
            sw.WriteLine(DateTime.Now.ToLongDateString())
         Finally
             sw.Close()
         End Try  
   
    End Sub
   
End Class
 
Back
Top