I would like to clear the clipboard, however sometimes this is during a loop and a file might still be in the process of copying to the clipboard so calling Clipboard.Clear()
raises an exception.
I made the following function to handle this:
Private Shared Sub ClearClipboard()
Dim b As Boolean = False
While b = False
Try
Clipboard.Clear()
b = True
Catch ex As Exception
End Try
End While
End Sub
This works fine on my machine running from Visual Studio, however on the client's machine the unhandled exception message pops up. Why is it not being caught silently there?
Alternatively, if this is not the best way of going about it, how can I check if something is currently being copied to the clipboard and wait until it is finished? In other words is it possible to check if the clipboard is "busy"?