Text File Load with VB.Net and Rich TextBox

~OSD~ 2,201 Reputation points
2021-02-10T22:06:51.97+00:00

Hi,

I have text file which looks like as follows:
66549-image.png

Now I used Rich Text Box to display the contents of this text file on VB form as:

RichTextBox1.LoadFile("D:\Backup\AppList.txt", RichTextBoxStreamType.PlainText)  

I have noticed two strange characters (ÿþ) appended as:
66696-image.png

or sometimes on top as:
66684-image.png

Any thoughts why this strange characters appeared and how to get rid of them?

Developer technologies VB
{count} votes

Accepted answer
  1. Viorel 122.5K Reputation points
    2021-02-11T06:29:00.917+00:00

    Try an alternative:

    RichTextBox1.Text = File.ReadAllText("D:\Backup\AppList.txt")
    

    Or change the encoding of AppList.txt, if possible. Use “UTF-8 with signature” encoding.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.