سؤال

Assume I want to add to RichTextBox this text:

Text line 1
Text line 2
Text line 3

When Paste() to RichTextBox, it change \n to Paragraph break, but I want to keep \n as Line break. How I can do that? Thank!

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

المحلول

Keep \r, remove \n:

rtb.Selection.Text = Clipboard.GetText().Replace("\n", "");
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top