Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing a winform application using C#. I have menu like Edit -> Copy and Edit -> Paste.

Instead of using
C#
Clipboard
class to do copying and pasting can I use Operating System's ability to Copy and Paste text, image, link, etc...
Posted

1 solution

When you use the Clipboard class, you are using the OS copy and paste capability.
There is one and only one clipboard, and the static nature of every (useful) method that the Clipboard class contains reflects that. It is just an interface class for the OS system.
 
Share this answer
 
Comments
markand911 3-Apr-14 10:31am    
May be yes. Thats why i want to utilize that code instead of writing my code to copy and paste using Clipboard.

For example when we press ctrl+c irrespective of data type OS copies and pastes it.

I want to implement such generic copying and pasting functionality.

If have to write code to do so, it will be a headache.

So i m searching a way to do it as easily as possible.
OriginalGriff 3-Apr-14 10:38am    
Um.
No, it doesn't.
The software that receives the "Copy" command decides the type, and sets the Clipboard appropriately. For some controls (such as a TextBox) that is automatic, because it only supports text. For others, it can be a lot more complex, but it has to decide: the OS does not "work it out on the fly".
Think about it: if you set an array of bytes to the clipboard, is that MP3 data? AVI? ZIP? A file? An image? The OS doesn't know - the software that is sourcing the info does.
Guruprasad.K.Basavaraju 12-Apr-14 9:09am    
Wish there was a way to up vote this reply. Simple and elegant explanation..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900