RichTextFiles strings etc

Hi,

I have posted a previous question about rtf files and I've been stuck on it for a bit. I have tried to follow the suggestions but didn't get anywhere. Here's the original post's link.
http://www.cplusplus.com/forum/windows/138373/

With thanks to forum user Chervil, I have figured out how to read specific lines of text using a 'line number' for easy retreival and post programming editing. I've also worked out how exclude this line number so that the needed text is displayed only. See the following if needed:
http://www.cplusplus.com/forum/general/139709/

However, this is for text files only. If I try to do the same with rtf files, I get problems no doubt because of the formatting that goes with rtf files. The program I'm working on at the moment requires various text formatting. Hence the need for a rtf file.

So my new questions are:

1. Can you select a specific line of text in a rtf file and display this in a richTextBox by using the method richTextBox1->LoadFile(MyFile)? Would this be using bits of code like Substring(starting position) etc?

For example: I can get something like this to work:
1
2
3
String^ myString;
myString = "001 This is a test!";
richTextBox1->Text = myString->Substring(4);

This displays " This is a test1" in the desried richTextBox.

But I can't do it when loading a file. I'm also having trouble using c++/cli equivalent to string::find and string::npos.

2. Can a rtf and its formatting be stored in memory? If so, can specific lines be called from it and placed into a richTextBox?

3. If both are possible, which one easiest to learn 'how' for a beginner like me?

Thanks,
Last edited on
Topic archived. No new replies allowed.