S
Stijn
Hello
I'm new to vb.net. Can someone help me with this one? I'm trying to add text
to an existing file. The function has to add text at the end of an existing
text-file. The code I've got so far writes the text to the file. But it
overwrites the existing text in the file. What do I have to change to the
code to add text instead of overwriting?
The code:
Sub LogFoutmelding(ByVal strFoutmelding As String, ByVal strApplicatie As
String)
'Dim strPath = System.IO.Directory.GetCurrentDirectory()
Dim strErrorlog As String = "errorlog.txt"
Dim strDatum As String = System.DateTime.Now.Date.ToString
Dim strTijdstip As String = System.DateTime.Now.TimeOfDay.ToString
Dim strTsslijn As String = "-----"
Try
FileOpen(1, strErrorlog, OpenMode.Output)
PrintLine(1, strDatum)
PrintLine(1, strTijdstip)
PrintLine(1, strApplicatie)
PrintLine(1, strFoutmelding)
PrintLine(1, strTsslijn)
FileClose(1)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Thx in advance
Stijn
I'm new to vb.net. Can someone help me with this one? I'm trying to add text
to an existing file. The function has to add text at the end of an existing
text-file. The code I've got so far writes the text to the file. But it
overwrites the existing text in the file. What do I have to change to the
code to add text instead of overwriting?
The code:
Sub LogFoutmelding(ByVal strFoutmelding As String, ByVal strApplicatie As
String)
'Dim strPath = System.IO.Directory.GetCurrentDirectory()
Dim strErrorlog As String = "errorlog.txt"
Dim strDatum As String = System.DateTime.Now.Date.ToString
Dim strTijdstip As String = System.DateTime.Now.TimeOfDay.ToString
Dim strTsslijn As String = "-----"
Try
FileOpen(1, strErrorlog, OpenMode.Output)
PrintLine(1, strDatum)
PrintLine(1, strTijdstip)
PrintLine(1, strApplicatie)
PrintLine(1, strFoutmelding)
PrintLine(1, strTsslijn)
FileClose(1)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Thx in advance
Stijn