Richtextbox line-by-line

P

Peer K

Hi,

I need to build a small HTML editor - real simple stuff, just bold and
italic for now.

I set the fontstyle in my richtextbox with SelectionFont which seems to
work fine.

Now for the question. When the user presses a button I want to loop
through the lines in the richtextbox and output html (to a string for now).

It's fairly easy to just say foreach (String Line in richTextBox1.Lines)
but how do I get to the formatting associated with that line?

Any pointers?
 
M

Michael C

Isn't the formatted rtf text stored in the .Rtf property? It's not divided
up by lines so you can't foreach over the lines of text like in your
example. Not sure how the line separators are stored inside the .Rtf
property... /n or /r maybe? You'll have to play with it to find out... I'm
a little too tired to test right now and don't want to send you a bunch of
bad info...

Thanks,
Michael C., MCDBA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top