Solved

VB.Net - Copy RitchTextBox

Posted on 2013-06-20
5
272 Views
Last Modified: 2013-06-20
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
Comment
Question by:holemania
  • 3
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39262694
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
 

Author Comment

by:holemania
ID: 39262937
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
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39262944
Show it where?
0
 

Author Comment

by:holemania
ID: 39262955
Okay got it to work now.

Richtextbox.text.replace(Controlchars.lf, controlchars.crlf)
0
 

Author Closing Comment

by:holemania
ID: 39262959
Thanks.  I changed property and it's working now.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question