473,231 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

The Copy Buffer & RichTextBox

When I use ctrl-c to copy and ctrl-v to paste from a RichTextBox into
NotePad ... I get nice ASCII text with the proper returns. Everything
looks good. When I paste into WordPad ... I get the RichText font
attributes and paragraph formatting as seen in the RichTextBox. Again,
everything looks good.

Trying to do the above programmatically is causing me problems. The
text is there, but in NotePad the returns are absent and the square
boxes (formatting stuff) are visible. In WordPad, the text is there
with returns ... but the font color attributes and paragraph spacing
is absent.

I've read the online doco about multiformatting the copy buffer and
found this very interesting. I was wondering how the ctrl-c had worked
its magic between NotePad and WordPad. However, I have yet to
duplicate the RichTextBox copy command programmatically. Below are
some of the commands I have tried >>

// BeginBlock & EndBlock are saved index values.

DataObject data = new DataObject();
textBox.Select((int)BeginBlock, (int)(EndBlock - BeginBlock));
data.SetData(DataFormats.Text, true, textBox.SelectedText);
data.SetData(DataFormats.Rtf, false, textBox.SelectedText);


I've also tried UnicodeText and StringFormat formats with the bool
conversion set to true and false.

Any clues to how I can programmatically duplicate the RichTextBox's
built-in ctrl-c functionality?

Thanks for any help.

-- Tom
Feb 26 '08 #1
0 2091

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: David Londeck | last post by:
I am using Visual Basic 2003 and I have written a notepad like application using the RichTextBox control. I am having trouble trying to emulate Microsoft Words text block copy/paste feature. In...
by: Hariharan Subramony | last post by:
Hello Guys, I have an important issue and need solution at the earliest. Thanks in advance. I have a RichTextBox named say, ' rtb' that has the text "Hello, I am fine." To place it in the...
by: Legendary Pansy | last post by:
I was checking out the 101 C# Samples, specifically Windows Forms - Use the Clipboard. I took a look at the code for a while, and I understand what the program is doing with the cut, copy, pasting...
by: Curious | last post by:
Hi, I have program, creating multiple threads, and each thread is updating the same richtextbox(appending to previous text), and text in the statusbar. To update the richtextbox and statusbar,...
by: ivan.leben | last post by:
Let's say I have a piece of allocated memory which I want to expand and reuse if possible or allocate in a different part of RAM if resizing is not possible, however, in the latter case I don't...
by: positivebalance | last post by:
..net 2.0 richtextbox autodragdrop how to make the control respond to Ctrl key for move copy? it's handy to have the enableautodragdrop is true but two odd things I notice: 1. when I first...
by: AWW | last post by:
Using Textbox.Text = "123" & CStr(13) & "456" I expect 2 lines on the screen but get 1 line with 13 in it. It worked once in a RichTextBox but then stopped. I just want to display aligned tabular...
by: kellox | last post by:
Does anybody know the difference between the two static methods Buffer.BlockCopy and Array.Copy? It is said that Buffer.BlockCopy is faster than Array.Copy since it only checks boundary and then...
by: shakti s | last post by:
hi, My aplologies if this is really a silly question. I am trying to read contents like images and tables from one rich text box and paste it into another RTF control(i.e. another Richtextbox)....
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.