Pasting into RichTextbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If you paste from some sources, such as a post on this forum, to a
RichTextBox, all line feed information is lost (I believe they're replace by
spaces). I've noticed the same behavior with WordPad, but NotePad does not
lose the linefeed information. Does anyone know of a fix for this? Pasting
into a regular TextBox works fine, but a RichTextBox is required for other
reasons.
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
C++ to C++/CLI
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB or C# to C++/CLI
 
Ok - got it. After upgrading from the plain textbox to RichTextBox, I was
still using the parameterless Paste method. I changed it to the following:
DataFormats.Format thisFormat =
DataFormats.GetFormat(DataFormats.UnicodeText);
this.txtSource.Paste(thisFormat);

I lose original rich formatting (which isn't so important for my purpose),
but have gained intelligent line feed processing (e.g., line feeds from all
sources are retained and not turned into spaces in some cases). Still
wondering why the default 'Paste' method of RichTextBox takes such a bad
approach to line feeds though...
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
C++ to C++/CLI
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB or C# to C++/CLI
 
Ok - got it.

That's good, but I was hoping someone would give a complete explanation of
what is going on. I've noticed this phenomenon before and I don't know what
to expect anymore when I copy/paste.

Just curious - in your rtb, is WordWrap true or false?
 
Back
Top