VB.net Loop through RichTextBox to create HTML (to be used in Outlook email body)

Hi
I have previously used the code below to build HTML that will be held in a String variable that will then be used in an Outlook email.
I have a form with a RichTextBox that the user types into. I want to loop through the RichTextBox and create the HTML similar to that
below. How would I do this?

            oHBody = "<html><body><font size=3  color=black name = 'Century Gothic'>Hello " & oFullName & "</font></body></html>"
            oHBody = oHBody & "<br>"
            oHBody = oHBody & "<html><body><font size=3  color=black name = 'Century Gothic'>Please find attached your rental invoice for " & oUnit & "." & "</font></body></html>"
            oHBody = oHBody & "<br>"
            oHBody = oHBody & "<html><body><font size=3  color=black name = 'Century Gothic'>(" & oDetails & ")" & "</font></body></html>"
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I'm not sure how the RichTextBox fits into this. Does it contain the data for "oDetails", or something of that nature?

If it does, then you can refer to the Text property of that RTB:

oHBody = oHBody & "<html><body><font size=3  color=black name = 'Century Gothic'>(" & YourRTB.Text & ")" & "</font></body></html>"
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi
Thanks
I am trying to loop through each line of a RichTextBox and get the exact formatting of every letter in that line
including colors and produce an HTML string
Bob LearnedCommented:
If you are using Windows Forms, then the RichTextBox control has the Lines property, and you can use a for loop to get at each line in the control.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.