Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I'm trying to load the contnent of a rtf file in richtextbox by this code:

richtextbox.LoadFile(path,RichTextBoxStreamType.RichText);

but the text format is reset in richtextbox.

How can I solve this?

thanks.
Posted

Check if using the Rtf property helps you.
See here[^].
 
Share this answer
 
v3
1) Check it is an RTF file that you are loading: use Notepad or similar to ensure it is full of "/blah" statements.
2) Check it is a valid RTF file: Open it in WordPad and make sure your formatting is there and correct.
3) Examine the .Rtf property of the RichTextBox once it it loaded - does it look like the file you examined in Notepad?
4) Save the content using RichTextBox.SaveFile method. Examine it as in 1) and 2) above. Is it the same?

Sorry, but with such a limited description of your problem, it is not possible to say "do this" and it'll fix it!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900