>I have a form made of CBIZOBJNOLISTMAINTFORM. On this within the connection button, I have written a code to make connections to the remote SQL server. ALSO I have written the following code in the beginning of the click event of the button
>set procedure to common
>on error do errorrtn with lineno(1), program() ,message(), error()
>
>I have written following error handle routine in the file common.prg
>
>procedure errorrtn
>** Syntax: ON ERROR DO errorrtn WITH LINENO(), PROGRAM(), MESSAGE(), ERROR()
>parameters p_errline, p_errprog, p_errmsg, p_errno
>l_msg = 'Fatal error in '+p_errprog+', line '+ltrim(str(p_errline))+;
> '. '+p_errmsg+' ('+ltrim(str(p_errno))+')'
>messagebox(l_msg,16,"")
>cancel
>endproc
>
>Now the connection button runs fine, when I press the Close button on the form, it runs the errorrtn procedure in common.prg and says
>"FatalError in CERRORMGR.HANDLEERROR, line 66.File lockscreen.prg doesnot exist(1)."
>
>If I donot write the error handling code then this message doesnot occur.
You need too look at the line of code that is causing the error. Not the error routine.
You might do
SET ASSERTS ON
ASSERT .F. MESSAGE l_msg
Then chose debug. Look at the call stack to see what the line of code is that's causing the error handler to run. I think you'll find that lockscreen isn't being referenced correctly. It's a property. So it will be something like:
THISFORM.LOCKSCREEN
Or
WITH THISFORM
.LOCKSCREEN = .F.
ENDWITH
But not
LOCKSCREEN = .F.