How to handle blocked Clipboard

Exception : The Clipboard could not be cleared.

This typically occurs when the Clipboard is being used by another process.


Solution for this is, retry the clear() again after a delay.

private void ClearClipBoard()
{
  try
  {
     System.Threading.Thread.Sleep(10000);
     Clipboard.Clear();
  }
  catch (Exception ex)
 {
     ClearClipBoard();
  }
}
0

Add a comment

About Me
About Me
Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.