Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

IN A VB6 SUB GETTING THE NAME OF SUB DURING RUNTIME

Posted on 2007-12-06
3
Medium Priority
?
444 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
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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Loops Section Overview

972 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