Solved

VB.Net - Copy RitchTextBox

Posted on 2013-06-20
5
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

752 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