TRY-CATCH is working for me (VFP 9 SP2, Windows XP). What version of VFP and what OS do you have?
>Lucky me! I have to fix an error in some code that writes a text file to a floppy disk (if the user chose the floppy disk for data transmission instead of the Internet!).
>
>When the user forgets to put a floppy in the drive, or the floppy does not have sufficient space for some reason(!), I should try to trap the error and give the user a simple Messagebox with the error explained to them, and a graceful way out.
>
>You usually get 2 error messages (they are the same), then you exit out of the code....
>
>Here are the error messages...
>
>You get a system form with this as the title...
>"Windows - No Disk"
>
>"Exception Processing Message c0000013 paramaters 75b6bf9c blah blah.... "
>Cancel Try Again Continue...
>
>I press Continue....
>
>same thing pops up on the screen....
>
>Press Continue again...
>
>Then the form I am in exits back to the calling program.
>
>Here is the code for how I wanted to trap the error(s) and make them go AWAY.
>
>
>* If drive A is selected, copy to a and delete from c
>IF lcDrive == "A"
> lcSource = "c:\" + ALLTRIM(ThisForm.txtReportName.value)
> lcDest = "a:\" + ALLTRIM(ThisForm.txtReportName.value)
> ThisForm.txtStatus.value = "Copying to drive A:..."
>*TMT 01/22/2008 Code to fix problem of error message coming up when a problem with the *floppy disk (no disk, no room, bad copy, etc....)
> TRY
> COPY FILE (lcSource) TO (lcDest)
> CATCH TO oErr
> MESSAGEBOX("Catch: - " + ALLTRIM(STR(oErr.ErrorNo)))
> FINALLY
> ENDTRY
>*TMT
>
>
>How do I stop the two error messages and just have the "Catch: - 1102" show up instead.
>As it is, I get 3 error messages.... the 2 before and the Catch statement.... sigh.