Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep Clipboard Info after closing Program

I have an expanded DataGridView user control and some other NumericUpDown controls where the user can copy/paste information within my software and other software like Excel.

My problem is that when the user closes my software the information in the clipboard is lost. I would like this clipboard information to be kept, in case the information is not very big (maybe asking the user, as Microsoft Office Software does).

How can I leave this information in the clipboard, so that the user can use it afterwards?

like image 634
Fleve Avatar asked Feb 08 '23 22:02

Fleve


1 Answers

Use the overload of Clipboard.SetDataObject that allows you to pass in a value indicating what should happen to the data when the app exits:

true if you want data to remain on the Clipboard after this application exits; otherwise, false.

like image 68
stuartd Avatar answered Feb 16 '23 02:02

stuartd