Link to home
Start Free TrialLog in
Avatar of brianshoenhair
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.

Avatar of plq
plq
Flag of United Kingdom of Great Britain and Northern Ireland image

Basically its not possible, but...

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 ?
ASKER CERTIFIED SOLUTION
Avatar of Sethi
Sethi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial