Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 296
  • Last Modified:

VB.Net - Copy RitchTextBox

I created a button in VB.Net windows application to copy a ritchtextbox.  I keep getting the following when I paste.  How do I get rid of it?

Dim data As string = Richtextbox.RTF
Clipboard.SetText(data, TextDataFormat.text)

This is what it also copy and need to remove.

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}
\viewkind4\uc1\pard\f0\fs17 Sub Format()\par
THIS IS A TEST \par
TESTING \par
0
holemania
Asked:
holemania
  • 3
  • 2
1 Solution
 
käµfm³d 👽Commented:
That is what RTF code looks like. When you use the RTF property that is what you are going to get. If you want just the text, then use the Text property, not the RTF property.
0
 
holemaniaAuthor Commented:
Okay so using the Text, it removed that RTF Property.

However, it's just one long string with return carriage like the two boxes.  How can I do it so that it is displaying output correct?

Currently it's like the following:

THIS IS A TEST [][] TEST

Would like to get it so that it shows as followed:

THIS IS A TEST
TEST
0
 
käµfm³d 👽Commented:
Show it where?
0
 
holemaniaAuthor Commented:
Okay got it to work now.

Richtextbox.text.replace(Controlchars.lf, controlchars.crlf)
0
 
holemaniaAuthor Commented:
Thanks.  I changed property and it's working now.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now