idiottan

We are Final Year students of engineering working on a project and have encountered a difficulty regarding the creation of an HTML file using RichTextBox.Let me try to explain the problem in detail.

We are using RichTextBox1.Savefile() utility to save the contents of the RichTextBox with an HTML file extension.However,when we try to open this saved file from its location on the hard disk,each line in the file is preceded by "\par",which gets added automatically. If we open this same file now in the RichTextBox, the content gets displayed without the "\par".

Is there any way to save the contents of the RichTextBox without the above happening

We would be really grateful if anyone could please help us out in this respect.



Re: Visual Basic General Using RichTextBox to store HTML files

nogChoco

The "\par" part seems to only appear at the end of a line, so assuming there's always a CarriageReturn+LineFeed charactercombination after it, you could use a .Replace method like this:

Dim zTrimString As String = "\par" & vbCrLf
Dim zRTF As String = RichTextBox1.Rtf.Replace(zTrimString, vbCrLf)
My.Computer.FileSystem.WriteAllText("c:\MyFile.rtf", zRTF, False)