writing from richtextbox/string variable to text file problem

adshocker

Well-known member
Joined
Jun 30, 2007
Messages
180
Programming Experience
Beginner
hi all,

in trying to save data from richtextbox to a text file, i noticed that the new lines are not saved. like for example, when typing then pressing enter to go to the next line, after saving the data to a text file, the enter keys pressed where not recognized / saved in the text file itself. the strings seems to form one line.

here's my code.
Imports System.IO

Dim myDir As String
myDir = "C:\TEMP"
Dim txtFile As StreamWriter = IO.File.CreateText(myDir & "sample.tab")
txtFile.Write(RichTextBox1.Text)
txtFile.Close()

I found out that upon using other text editors, the new line characters are ok but not in notepad which is what i normally use. can anyone help? thanks
 
Back
Top