Question

There is a richTextBox that has string. I want to select a few characters on the richTexBox by mouse and save them in a variable. I use this method:

richTextBox1.SelectedRtf;

It shows me selected characters but is has some additional string and i don't want them. How can I remove them?

This is additional string: {\rtf1\fbidis\ansi\ansicpg1256\deff0\deflang1065\uc1 }

Was it helpful?

Solution

try

 richTextBox1.SelectedText

Here is the msdn link for more information
http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.selectedtext(v=vs.110).aspx

OTHER TIPS

Selection.Text property will return the selected text of Rich Edit Text box.

richTextBox1.Selection.Text

use this

richTextBox1.SelectedText (property)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top