Link to home
Start Free TrialLog in
Avatar of zipnotic
zipnoticFlag for United States of America

asked on

Combining RTFs into a single one for richtextbox.rtf

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?



Thanks

                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

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

                richtextbox1.rtf = NarrativeText
ASKER CERTIFIED SOLUTION
Avatar of zipnotic
zipnotic
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial