![]() If m.llInUse & couldn't get exclusive lock on all tables Use (addbs(m.tcFolder)+laTables) in 0 exclusive LcError = on('error') & save current handlerįor ix=1 to adir(laTables, addbs(m.tcFolder) + '*.dbf')) Local lcOldError, llInUse, ix & by default these variables have a value of. For example, at one point you want to open all tables in a folder exclusively, and if you can't you don't want to continue: procedure DoSomethingWithExclusiveLock(tcFolder) You can also change and restore the error handler in between. MESSAGEBOX(lcDetails, 16, "Unhandled Exception") 'Line number of error: ' + TRANSFORM(tnLineNumber) TO lcDetails 'Procedure with error: ' + tcProcWithError + CHR(13) + 'Error number: ' + TRANSFORM(tnVFPErrorNumber) + CHR(13) + STORE 'Error message: ' + tcVFPErrorMessage + CHR(13) + ![]() ![]() LPARAMETERS tnVFPErrorNumber, tcVFPErrorMessage, tcProcWithError, tnLineNumber ON ERROR DO errorHandler WITH ERROR(), MESSAGE(), PROGRAM(), LINENO()Ī simple errorHandler method may look like the following. The values returned by ERROR (the VFP Error Number), MESSAGE (the VFP Error Message), PROGRAM (name of the currently executing program) and LINENO (the line number of the error) are passed to the errorHandler method. ![]() The following ON ERROR command calls a method in the current program called "errorHandler". A simple way to catch unhandled errors (exceptions) in a VFP application is to use the ON ERROR command near the beginning of your main program.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |