Public Sub WriteData(ByVal strData As String, ByVal dir As String, ByVal path As String, _
ByVal append As Boolean)
'Check directory first
If Not (Directory.Exists(dir)) Then
Directory.CreateDirectory(dir)
End If
Dim objReader As StreamWriter
Try
objReader = New StreamWriter(path, append)
objReader.Write("Date & Time: " & Now() & vbCrLf & "Message: " & strData & vbCrLf)
objReader.WriteLine(vbCrLf)
objReader.Close()
Catch Ex As Exception
Throw New Exception(Ex.Message)
End Try
End Sub




