Posted By

mracoker on 02/02/10


Tagged

file log VBNet write


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

goo
D4RKCODE


VB.NET Log File


 / Published in: VB.NET
 

  1. Sub Log(ByVal txt As String)
  2. 'Open a file for writing
  3. Dim FILENAME As String = Server.MapPath("Log.txt")
  4.  
  5. 'Get a StreamReader class that can be used to read the file
  6. Dim objStreamWriter As StreamWriter
  7.  
  8. objStreamWriter = File.AppendText(FILENAME)
  9.  
  10. objStreamWriter.WriteLine(DateTime.Now.ToString() + " >> " + txt)
  11.  
  12. 'Close the stream
  13. objStreamWriter.Close()
  14. End Sub

Report this snippet  

You need to login to post a comment.