?
Solved

IN A VB6 SUB GETTING THE NAME OF SUB DURING RUNTIME

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Make the most of your online learning experience.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

718 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