vbnet Write to file

Sub LogToFile(ByVal Message As String)
	If My.Settings.LogToFile = True Then
		Dim LogFile As String = My.Settings.LogFile
		Dim filestream As FileStream
		Dim streamwriter As StreamWriter

		filestream = New FileStream(LogFile, FileMode.Append)
		streamwriter = New StreamWriter(filestream)

		streamwriter.WriteLine(Now.ToString & Message)

		streamwriter.Close()
		streamwriter.Dispose()

		filestream.Close()
		filestream.Dispose()
	End If
End Sub
Writes a Message to a file.

Updated: Saturday 9th October 2010, 09:59pm

There are 0 comments

Leave a comment of your own

Comments are currently closed.