1.

Solve : Adding a Copy function with C#.Net - Help?

Answer»

:-? :-?

Hi

I need to add code in C#.Net that allows a USER to RIGHT click and select the COPY FUNCTION. This would allow the user to copy information to the clipboard and paste elsewhere.

SOS
HELPFor text, use the SetText method:

Clipboard.SetText(data, dataformat)

To retrieve the clipboard data, use the GetText method:

Clipboard.GetText(dataformat)

Note: there are other formats besides text (images, audio, etc). Match the method (Get/SetImage, Get/SetAudioStream, etc) to your data format.

Hope this helps.  8-)

Note: The C#.NET help index has much information on this and many other subjects.
This does not really help

I need a fuction that I can use from any where on the form.
That applies to a single object such as a textbox or image, etc.

I need something more generic. The same piece of code should work on any object not just a particular object.

Is this possible???
HelpI would think you could QUERY the dataformat of the object and handle it with the appropriate code. Not familiar with C# but in VB this would be the way to go. Pass the object and the dataformat to the function and set up the set/get commands as needed.

Good luck.  8-)



Discussion

No Comment Found