I came across a weird error in my application today. I have a screen with grid and on clicking Retrieve, Grid is populated with data. On clicking on a cell and on mouse right click, I will be prompted with custom context menu with Copy and paste option. When i click on Copy menu item, i was thrown with the below error.
"Requested clipboard operation did not succeed"
On debugging through the code, I was able to find that I encountered the error when I try to paste the value into the clipboard.
The above method, SetDataObject is an override method for clipboard operations. Please find below for some more information on the method
Explanation:
Clears the Clipboard and then attempts to place data on it the specified number of times and with the specified delay between attempts, optionally leaving the data on the Clipboard after the application exits.
public static void SetDataObject(
Object data,
bool copy,
int retryTimes,
int retryDelay
)
Namespace: System.Windows. Forms
Parameters
data
Type: System.Object
The data to place on the Clipboard.
copy
Type: System.Boolean
true if you want data to remain on the Clipboard after this application exits; otherwise, false.
retryTimes
Type: System.Int32
The number of times to attempt placing the data on the Clipboard.
retryDelay
Type: System.Int32
The number of milliseconds to pause between attempts.
Hope the information will be useful for you. See you with some interesting info next time. Please feel free to comment.
Hope the information will be useful for you. See you with some interesting info next time. Please feel free to comment.
No comments:
Post a Comment