Hi everybody, thanks for reading, im a beginner with VB .NET and i was wondering how i can make VB to write the data from my textbox to a .txt , making it a log. The thing is my textbox is multiline, but when i log the data to the .txt it perfectly works BUT it doesnt do it in a multi line way. For example this is MY textbox:
[Date/Hour] You have entered the matrix
[Date/Hour] Thanks for entering the matrix.
and this is how it logs to the .TXT:
[Date/Hour] You have entered the matrix [Date/Hour] Thanks for entering the matrix.
This is the way i use it :
How can i make my .txt log to be as my textbox, multiline, thanks in advance and for answering my question.
[Date/Hour] You have entered the matrix
[Date/Hour] Thanks for entering the matrix.
and this is how it logs to the .TXT:
[Date/Hour] You have entered the matrix [Date/Hour] Thanks for entering the matrix.
This is the way i use it :
VB.NET:
Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click
RichTextBox1.Text = RichTextBox1.Text & vbNewLine
Dim FILE_NAME As String = "C:\log.txt"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
objWriter.Write(RichTextBox1.Text & Environment.NewLine)
objWriter.Close()
MsgBox("Text written to file")
Else
MsgBox("File Does Not Exist")
End If
Me.Close()
End Sub
How can i make my .txt log to be as my textbox, multiline, thanks in advance and for answering my question.