troubleshooting Question

Combining RTFs into a single one for richtextbox.rtf

Avatar of zipnotic
zipnoticFlag for United States of America asked on
.NET Programming
1 Comment1 Solution62 ViewsLast Modified:
I am trying to combine a series of rtf into a single one for display into a richtextbox.rtf property.

I'm using the following code to trim the first and last characters so they all display at once but the last RTF is being ignored.  Everything up until the last rtf is displaying perfectly.  After a couple of hours of fiddling I still can't figure out how to properly concatenate and terminate these things.

Here's the code to remove trailing characters of the first RTF and leading character of subsequent RTFs then add in the trailing characters at the end.  I think I tried various combinations thereof but I'm hoping someone with more RTF knowledge can point me in the right direction?


                For i = 0 To dsRM.Tables("Narratives").Rows.Count - 1
                    If i = 0 Then
                        NarrativeText += dsRM.Tables("Narratives").Rows(i)("NarrativeRTF")
                        NarrativeText = NarrativeText.Substring(0, NarrativeText.Length - 3)
                        trailingthree = NarrativeText.Substring(NarrativeText.Length - 3)
                    End If

                    If i > 0 Then
                        tempNar = dsRM.Tables("Narratives").Rows(i)("NarrativeRTF")
                        NarrativeText += tempNar.Substring(1, tempNar.Length - 1)
                    End If

                NarrativeText += trailingthree
                MsgBox("added last r} back in")

                richtextbox1.rtf = NarrativeText

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros