B
Baz
Hi All,
Below is some sample code from a .NET sub I created. It seems to work
OK, but sometimes when I call the routine and pass it a string, the
actual data written to the file is followed by a lot of blank space. I
haven't counted the amount of empty data logged to the file, but it is
thousands and thousands of bytes. The strange thing is that it only
happens sometimes, and not others. Am I doing something completely
wrong? Can anyone see a flaw in the code?
Apologies if this code is not the best way of implementing the desired
solution - I am a very new convert to .NET
Thanks,
Baz.
=====
Public Sub LogIt(ByVal Message As String)
Dim sFilename As String = Application.StartupPath & "\Test.txt"
Dim sr As New StreamWriter(sFilename, True)
sr.Write("[" & Now.Date.ToString & "] [" & Now.TimeOfDay.ToString &
_
"] " & Message)
sr.Close()
End Sub
=====
Below is some sample code from a .NET sub I created. It seems to work
OK, but sometimes when I call the routine and pass it a string, the
actual data written to the file is followed by a lot of blank space. I
haven't counted the amount of empty data logged to the file, but it is
thousands and thousands of bytes. The strange thing is that it only
happens sometimes, and not others. Am I doing something completely
wrong? Can anyone see a flaw in the code?
Apologies if this code is not the best way of implementing the desired
solution - I am a very new convert to .NET
Thanks,
Baz.
=====
Public Sub LogIt(ByVal Message As String)
Dim sFilename As String = Application.StartupPath & "\Test.txt"
Dim sr As New StreamWriter(sFilename, True)
sr.Write("[" & Now.Date.ToString & "] [" & Now.TimeOfDay.ToString &
_
"] " & Message)
sr.Close()
End Sub
=====