views:

291

answers:

1

I have this RichTextbox in my vb.net form and I would like to when a user click a button, for example to embold the selected text, how would I do this.

Also, I do NOT want to use the standard vb.net expressions such as RichTextBox1.SelectedText.Font.Bold = true. I want to do something like RichTextbox1.SelectedRTF="[bold]" & RichTextBox1.SelectedRTF & "[/bold]" or whatever RTF looks like.

Can I just add the RTF options random places or can a RichTextBox return an error if the text is in wrong format. I'm mostly looking for info on how to work with RTF without using the standard vb expressions. Thank you very much for any help provided

+2  A: 

It just doesn't work this way, it is not an HTML editor. Hacking RTF directly is technically possible through the Rtf property but very hard to get right. RTF is not exactly a friendly format. Start reading here, try not to panic at the quality of that first page. Well, go ahead.

Hans Passant
Do you know of any other text-based script I can use, I read about an extended RichTextBox plugin for vb.net somewhere, maybe that is capable of doing such thing more probablyI'm trying to find a better solution indeed, I just found that by changing the RTF directly the Redo/Undo does not work, which is a must!
Jacob Kofoed