Solved

IN A VB6 SUB GETTING THE NAME OF SUB DURING RUNTIME

Posted on 2007-12-06
3
441 Views
Last Modified: 2008-02-01
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
 
0
Comment
Question by:BIAPRO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 20423625
>???    ????????? 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.
0
 
LVL 31

Expert Comment

by:Frosty555
ID: 20424891
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
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 500 total points
ID: 20427495
This free add-on for VB6:

http://www.mztools.com/v3/download.aspx

Has a feature to add error handling that uses templates and markers to add code to a procedure.  You can change the template for your own style of error handling.  One of the variables it can use is the procedure name.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question