Marvin
Marvin

Reputation: 1

Using richtextbox instead of File.WriteBytes

I am using this code now:

Dim data() As Byte = File.ReadAllBytes("D:\desktop\image.png")
File.WriteAllBytes("D:\desktop\file.txt", data)

Instead of File.WriteAllBytes (writing to a file) I want to write those bytes to a richtextbox, is this possible?

Thanks!

Upvotes: 0

Views: 52

Answers (1)

user4376581
user4376581

Reputation:

you can use like the following

    Dim data() As Byte = File.ReadAllBytes("K:\sample.txt")
    ritchText.Text = System.Text.Encoding.UTF8.GetString(data)

If you give the input as image file then you will get only Unicode characters. if you give textfile like the above then will give the exact content of the input file.

Upvotes: 1

Related Questions