سؤال

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 }

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

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

richTextBox1.Selection.Text

use this

richTextBox1.SelectedText (property)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top