brianshoenhair
asked on
How can I retreive the line, module and prodedure where an error occurs?
Please give a detailed example
I want to have a fuction that will return:
The Module or Form that the error occurs in.
The Procedure that the error occurs in.
The line the error occurs in.
And of course in will return Err.Number and Err.Description.
I want to have a fuction that will return:
The Module or Form that the error occurs in.
The Procedure that the error occurs in.
The line the error occurs in.
And of course in will return Err.Number and Err.Description.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
From an exe you have to put context information in your code.
This can be
(a) a global which sets a context string
(b) a stack class which adds a context every time you do a call, and removes the context every time you return
option (b) can be a performance hit. option (a) doesn't always give you the info you need. so its down to what your requirements are.
From VB you can set tools - options - break on all errors. Then the debugger will break on the error line. I guess you knew that already ?