Computer Science Canada Error 521 |
Author: | HazySmoke)345 [ Fri Feb 03, 2006 9:30 pm ] | ||
Post subject: | Error 521 | ||
I'm editing a program that clears the clipboard automatically, but occasionally, that run-time error comes out, telling me that the computer "Cannot open clipboard", but if I wait for a while, and run the program again, it will work once more. So I'm just trying to make the computer to keep trying to clear it if the error comes out.
But the run-time error still comes out. Can we make the computer omit it and try again? |
Author: | Brightguy [ Sun Feb 05, 2006 9:10 pm ] | ||
Post subject: | Re: Error 521 | ||
Of course you could just call ClearClipboard again in your error handling, but to avoid the possibility of an infinite loop you might want to add something like:
|
Author: | HazySmoke)345 [ Mon Feb 06, 2006 9:43 pm ] |
Post subject: | Re: Error 521 |
Brightguy wrote: Of course you could just call ClearClipboard again in your error handling
What do you mean by that? The thing is that, as my program bumps into an error, it stops no matter what, even if there's the "On Error Goto" statement. I just need some help clearing that problem. |
Author: | Brightguy [ Tue Feb 07, 2006 1:06 pm ] |
Post subject: | Re: Error 521 |
HazySmoke)345 wrote: The thing is that, as my program bumps into an error, it stops no matter what, even if there's the "On Error Goto" statement.
The problem is that you call Clipboard.Clear again in the error handling, and this has a good chance of causing another error. You can't handle errors when error handling. If all you want to do is retry until it's free, you wouldn't have to do anything inside your error handling at all - just use Resume to try the line which caused the error again. However, this could cause an infinite loop if the other application really doesn't want to let go of the clipboard. |