I have an RTF text box control, and there are certain parts of the textbox that I want to update. My plan was to enclose the update-able text within some hidden text markers. For example,
{\rtf1 \v startlab\v0 Diagnostic Results\v endlab\v0}
or even
{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\pard\lang1033\f0\fs17 {\rtf1\ansi{\v startlab}}Diagnostic Results{\rtf1\ansi{\v endlab}}\par}
That way, I can just do a search for the beginning and ending tags and replace the text in between.
The problem is that VB.NET re-organizes the RTF and it becomes very hard to search for them.
For example, the above rtf gets rendered into
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}
\viewkind4\uc1\pard\lang1033\v\f0\fs17 startlab\v0 Diagnostic Results\v endlab\v0\par
}
It also seems that the textbox doesn't understand \v
because the text is rendered as
startlabDiagnostic Resultsendlab
So......
My questions are as follows:
- Is there any way to have hidden text in a .NET rtf textbox?
- Failing that, is there any good way to replace a particular section of text without making the beginning and ending markers visible to the user?