We help IT Professionals succeed at work.
Get Started

Combining RTFs into a single one for richtextbox.rtf

zipnotic
zipnotic asked
on
58 Views
Last Modified: 2020-03-18
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
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE