Solved

VB.Net - Copy RitchTextBox

Posted on 2013-06-20
5
271 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
A short film showing how OnPage and Connectwise integration works.

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now