Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm trying to use the Rtf property of a RichTextBox as a string, but I'm running into problems with concatenating it with other strings. Anything after the Rtf text is cut off. Has anyone noticed problems with this and, if so, found a fix?

 

Attached is a simple project so you can see what I mean. Just type some text into the box and click the button. Notice the string after the Rtf text does not get printed in the Output window.

rtf bug[1].zip

Here's what I'm up to.
  • *Gurus*
Posted

That's really weird. I get that behaviour too, even using StringBuilder to concatenate text. I was half thinking I wouldn't be able to reproduce it because I'm using VS.NET 2003, but I am.

 

If I try and concatenate the string using the command window however, it works. It would be worth a post in the newsgroups to see what MS says about it.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted
Posted the problem to the MS newsgroups and got an answer. It appears null characters are tacked on the end of the RTF text which prevents anything from being concatenated to it. Calling the Rtf property's Replace function to replace the nulls with an empty string seems to fix it.
Here's what I'm up to.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...