Solved

VB.Net - Copy RitchTextBox

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

Accepted Solution

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

Expert Comment

by:käµfm³d 👽
Comment Utility
Show it where?
0
 

Author Comment

by:holemania
Comment Utility
Okay got it to work now.

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

Author Closing Comment

by:holemania
Comment Utility
Thanks.  I changed property and it's working now.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

15 Experts available now in Live!

Get 1:1 Help Now