Reading richtextbox line contains text and image

kattah

New member
Joined
Aug 11, 2015
Messages
2
Programming Experience
Beginner
Hello every body

I have a richtextbox which contains many lines, I want to load it line by line into another richtextbox, and when I use:

RichTextBox2.Text = RichTextBox1.Lines(i)

that show me only the text but no pictures (when the line contains)

How can I solve this?

thanks.
 
Images are not text, they are encoded as binary data within the rtf. You probably need to Select the line and transfer SelectedRtf. GetFirstCharIndexFromLine may be your best help for finding indexes to select a line.
 
Thank you very much Mr. JohnH
With the help of this idea I have solved the problem using: select,copy,paste:
VB.NET:
RichTextBox1.LoadFile("D:\aaa\2.rtf")
RichTextBox1.SelectionStart = RichTextBox1.GetFirstCharIndexFromLine(3)
RichTextBox1.SelectionLength = RichTextBox1.Lines(3).Length
RichTextBox1.Copy()
RichTextBox2.Paste()
 
Back
Top