Link to home
Start Free TrialLog in
Avatar of jack niekerk
jack niekerkFlag for Netherlands

asked on

IN A VB6 SUB GETTING THE NAME OF SUB DURING RUNTIME

I have at main.form a hidden  dummy label,  on event when it changes I jump to popup(forced)
Its caption get sa value if in a sub is a error like:

Private sub Something
on error goto Report
'some code......
exit sub
Report:
Thelabel.caption= " error n# " & str$(err) & " in line " & str$(erl)  & "in submodule: &  ???    ????????? now here i would like to add the name of this sub???
so the label will show      " error n# x   in line  x   in module Someting
resume next
end sub
 
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

>???    ????????? now here i would like to add the name of this sub???
There is no variable or property that contains the name of the sub that is currently running.  You'll have to type it in manually in every sub.
The best you have is
Err.number      -   error code number
Err.description   -  description of error as it appears in the error window in vb
Err.source     - usually the name of the project, but if you raise your own errors using Err.raise() you can specify what the value is
ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada 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