Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick question on set console and VFP error

Status
Not open for further replies.

VBFOXDEV35

Programmer
Mar 26, 2001
77
US
All:

Real quick question. I have an error handler built into my code, however sometimes when this handler fires, it causes any output to be directed to the current open form/screen

Can anyone tell me what might cause this? It's almost as if a VFP error set's the console back on, very strange.

Here is my error handler just in case it might be incorrect:

PROCEDURE HandleError
PARAMETER plngLineNo
LOCAL strTitle
LOCAL strBody
LOCAL strProgram

CLOSE DATABASES
SET CONSOLE OFF
SET ALTERNATE OFF
SET BELL ON
IF ERROR() = 2028 THEN
RETRY
ENDIF
IF VarType(plngLineNo) = "L" THEN
plngLineNo = 0
ENDIF
strProgram = SYS(16,PROGRAM(-1)-2)
IF AT(" ",strProgram) > 0 THEN
strProgram = SUBSTR(strProgram,RAT(" ",strProgram) + 1)
ENDIF
IF AT("\",strProgram) > 0 THEN
strProgram = SUBSTR(strProgram,RAT("\",strProgram) + 1)
ENDIF
strProgram = LEFT(strProgram,MAX(LEN(strProgram)-4,0))
IF strProgram <> PROGRAM(PROGRAM(-1)-2) THEN
strProgram = strProgram + &quot;.&quot; + PROGRAM(PROGRAM(-1)-2)
ENDIF
strTitle = &quot;Notice #&quot; + LTRIM(STR(ERROR()))
strBody = MESSAGE() + CHR(13) + CHR(10) + CHR(13) + CHR(10)
strBody = strBody + &quot;Line #&quot; + LTRIM(STR(plngLineNo)) + &quot; of &quot; + strProgram
IF !EMPTY(MESSAGE(1)) THEN
strBody = strBody + &quot;:&quot; + CHR(13) + CHR(10) + &quot; &quot; + MESSAGE(1)
ENDIF
IF !EMPTY(GetSysData(&quot;CLASDIR&quot;)) THEN
strBody = strBody + CHR(13) + CHR(10) + CHR(13) + CHR(10)
strBody = strBody + &quot;Cancel will reset the program to when the deal was first selected.&quot;
ENDIF
IF MessageBox(strBody,5 + 64,strTitle) = 4 THEN
RETRY
ENDIF
WAIT CLEAR
ON ERROR
CLOSE DATABASES
CLEAR EVENTS
RELEASE ALL
CLOSE ALL
IF VARTYPE(gfrmSplash) = &quot;O&quot; THEN
gfrmSplash.Release
ENDIF
CHDIR &gstrFishDir.
** set flag that there was an error to reload winfish
blnHaveError = .T.
SET BELL OFF
RETURN TO MASTER


Thanks all for those who reply.

Art


Art DeGaetano II
Software Developer, MOUS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top