Home All Groups Group Topic Archive Search About

VB6 - Pass current Procedure Name to Error Handling Routine

Author
11 May 2005 12:14 PM
rmsterling
Subject: VB6 - Pass current Procedure Name to Error Handling Routine

Using VB6

Examine the following code....

Public Sub Error_Handler(lErrNo As Long, sErrMsg As String,
sProcErrorOccurredIn As String)

<code>

End Sub

Public Sub Test_Routine

  On Error Goto Test_Routine_Err

  <code>

  Exit Sub
Test_Routine_Err:
  Call Error_Handler(Err,Error$,<Proc Name>)

End Sub

---

I need to know how to send the current procudure / function name to the
Error Handler routine without having to type the name in manually for every
single call to this routine. This is to minimize code maintenance.

Is there an object that will return this information to me?

Look forward to your reply.

Thanks,
Regards,
Richard.



--
----------------------------
Regards,
Richard Sterling
Senior Software Engineer Tel : +44 (0)1707 392200 ext 4815
Avaya ECS Ltd, United Kingdom
mailto:rmsterl***@avaya.com

Author
11 May 2005 12:25 PM
Jan Hyde
"rmsterling" <rmsterl***@avaya.com>'s wild thoughts were
released on Wed, 11 May 2005 05:14:01 -0700 bearing the
following fruit:

Show quote
>Subject: VB6 - Pass current Procedure Name to Error Handling Routine
>
>Using VB6
>
>Examine the following code....
>
>Public Sub Error_Handler(lErrNo As Long, sErrMsg As String,
>sProcErrorOccurredIn As String)
>
><code>
>
>End Sub
>
>Public Sub Test_Routine
>
>  On Error Goto Test_Routine_Err
>
>  <code>
>
>  Exit Sub
>Test_Routine_Err:
>  Call Error_Handler(Err,Error$,<Proc Name>)
>
>End Sub
>
>---
>
>I need to know how to send the current procudure / function name to the
>Error Handler routine without having to type the name in manually for every
>single call to this routine. This is to minimize code maintenance.
>
>Is there an object that will return this information to me?
>
>Look forward to your reply.
>

Get MZTools Version 3

www.mztools.com

It's free, you can use it to set up error handler templates,
and it can insert the proc name for you.




Jan Hyde (VB MVP)

--
Handkerchief:     Cold storage. (John Nunley)

[Abolish the TV Licence - http://www.tvlicensing.biz/]
Author
11 May 2005 12:34 PM
rmsterling
Sorry but I have bad experiences using Error Handler inserter programs. I do
not wish to use one.

Given the code I have is there another way of achieving what I want?

Show quote
"Jan Hyde" wrote:

> "rmsterling" <rmsterl***@avaya.com>'s wild thoughts were
> released on Wed, 11 May 2005 05:14:01 -0700 bearing the
> following fruit:
>
> >Subject: VB6 - Pass current Procedure Name to Error Handling Routine
> >
> >Using VB6
> >
> >Examine the following code....
> >
> >Public Sub Error_Handler(lErrNo As Long, sErrMsg As String,
> >sProcErrorOccurredIn As String)
> >
> ><code>
> >
> >End Sub
> >
> >Public Sub Test_Routine
> >
> >  On Error Goto Test_Routine_Err
> >
> >  <code>
> >
> >  Exit Sub
> >Test_Routine_Err:
> >  Call Error_Handler(Err,Error$,<Proc Name>)
> >
> >End Sub
> >
> >---
> >
> >I need to know how to send the current procudure / function name to the
> >Error Handler routine without having to type the name in manually for every
> >single call to this routine. This is to minimize code maintenance.
> >
> >Is there an object that will return this information to me?
> >
> >Look forward to your reply.
> >
>
> Get MZTools Version 3
>
> www.mztools.com
>
> It's free, you can use it to set up error handler templates,
> and it can insert the proc name for you.
>
>
>
>
> Jan Hyde (VB MVP)
>
> --
> Handkerchief:     Cold storage. (John Nunley)
>
> [Abolish the TV Licence - http://www.tvlicensing.biz/]
>
>
Author
11 May 2005 1:29 PM
Jeff Johnson [MVP: VB]
"rmsterling" <rmsterl***@avaya.com> wrote in message
news:FBB8797D-04D6-42AA-A162-7D995CC6B8E0@microsoft.com...

> Given the code I have is there another way of achieving what I want?

A) Learn to search newsgroups. This question comes up quite often.
http://groups-beta.google.com/advanced_search.

B) There is absolutely no way to "look up" the function name. It MUST be
inserted into the code, either manually by you or by an "Error Handler
inserter" that you stated you don't want to use.
Author
13 May 2005 12:30 PM
Tony Proctor
Re: B)
This is not strictly true Jeff as the names exist in any run-time symbol
table. Code exists to retrieve the current procedure name from the debug
symbol table, and I've used to it to good effect. However, it's probably
overkill for what the OP wants here.

        Tony Proctor

Show quote
"Jeff Johnson [MVP: VB]" <i.get@enough.spam> wrote in message
news:OsJbx1iVFHA.4076@TK2MSFTNGP14.phx.gbl...
>
> "rmsterling" <rmsterl***@avaya.com> wrote in message
> news:FBB8797D-04D6-42AA-A162-7D995CC6B8E0@microsoft.com...
>
> > Given the code I have is there another way of achieving what I want?
>
> A) Learn to search newsgroups. This question comes up quite often.
> http://groups-beta.google.com/advanced_search.
>
> B) There is absolutely no way to "look up" the function name. It MUST be
> inserted into the code, either manually by you or by an "Error Handler
> inserter" that you stated you don't want to use.
>
>
Author
13 May 2005 1:24 PM
Jeff Johnson [MVP: VB]
"Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in message
news:usPsFe7VFHA.1404@TK2MSFTNGP09.phx.gbl...

> Re: B)
> This is not strictly true Jeff as the names exist in any run-time symbol
> table. Code exists to retrieve the current procedure name from the debug
> symbol table, and I've used to it to good effect. However, it's probably
> overkill for what the OP wants here.

Wow. It took almost two days for someone to respond to that. I'm almost
disappointed in the group....

(And next time the question comes up I'll STILL say there's no way to do
it....)
Author
11 May 2005 2:19 PM
Jan Hyde
"rmsterling" <rmsterl***@avaya.com>'s wild thoughts were
released on Wed, 11 May 2005 05:34:01 -0700 bearing the
following fruit:

>Sorry but I have bad experiences using Error Handler inserter programs. I do
>not wish to use one.

MZTools has been used by lots of people for many years,
don't let one bad experience put you off using THE most
useful tool available to VB programmers.

>Given the code I have is there another way of achieving what I want?

The ONLY other option is to do it manually.

J


Show quote
>"Jan Hyde" wrote:
>
>> "rmsterling" <rmsterl***@avaya.com>'s wild thoughts were
>> released on Wed, 11 May 2005 05:14:01 -0700 bearing the
>> following fruit:
>>
>> >Subject: VB6 - Pass current Procedure Name to Error Handling Routine
>> >
>> >Using VB6
>> >
>> >Examine the following code....
>> >
>> >Public Sub Error_Handler(lErrNo As Long, sErrMsg As String,
>> >sProcErrorOccurredIn As String)
>> >
>> ><code>
>> >
>> >End Sub
>> >
>> >Public Sub Test_Routine
>> >
>> >  On Error Goto Test_Routine_Err
>> >
>> >  <code>
>> >
>> >  Exit Sub
>> >Test_Routine_Err:
>> >  Call Error_Handler(Err,Error$,<Proc Name>)
>> >
>> >End Sub
>> >
>> >---
>> >
>> >I need to know how to send the current procudure / function name to the
>> >Error Handler routine without having to type the name in manually for every
>> >single call to this routine. This is to minimize code maintenance.
>> >
>> >Is there an object that will return this information to me?
>> >
>> >Look forward to your reply.
>> >
>>
>> Get MZTools Version 3
>>
>> www.mztools.com
>>
>> It's free, you can use it to set up error handler templates,
>> and it can insert the proc name for you.
>>
>>
>>
>>
>> Jan Hyde (VB MVP)
>>
>> --
>> Handkerchief:     Cold storage. (John Nunley)
>>
>> [Abolish the TV Licence - http://www.tvlicensing.biz/]
>>
>>


Jan Hyde (VB MVP)

--
Migration: A headache birds get when they fly down for the winter.
(Richard Lederer)

[Abolish the TV Licence - http://www.tvlicensing.biz/]
Author
11 May 2005 2:31 PM
Ken Halter
"Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message
news:b05481lar093s0tt8njis5eln7qqpjvfgo@4ax.com...
> "rmsterling" <rmsterl***@avaya.com>'s wild thoughts were
> released on Wed, 11 May 2005 05:34:01 -0700 bearing the
> following fruit:
>
>>Sorry but I have bad experiences using Error Handler inserter programs. I
>>do
>>not wish to use one.
>
> MZTools has been used by lots of people for many years,
> don't let one bad experience put you off using THE most
> useful tool available to VB programmers.

2nd most useful tool ;-) Here's THE most useful....

CodeSMART 2005 for VB6 - Screenshots
http://www.axtools.com/products/cs2k3vb_screenshots.htm

...check out how it connects If/Then/Else, etc, with "Branch Lines".... very
cool. Click on the "If" and it jumps to the "End If" too. Extremely cool <g>
Did I mention that it's very cool? ;-) Then, check out the project explorer.
Shows all procedures/events/apis/etc/etc (all optional)

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Sign up now to help keep VB support alive - http://classicvb.org/petition
Please keep all discussions in the groups..
Author
11 May 2005 2:48 PM
Jan Hyde
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com>'s wild
thoughts were released on Wed, 11 May 2005 07:31:25 -0700
bearing the following fruit:

Show quote
>"Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message
>news:b05481lar093s0tt8njis5eln7qqpjvfgo@4ax.com...
>> "rmsterling" <rmsterl***@avaya.com>'s wild thoughts were
>> released on Wed, 11 May 2005 05:34:01 -0700 bearing the
>> following fruit:
>>
>>>Sorry but I have bad experiences using Error Handler inserter programs. I
>>>do
>>>not wish to use one.
>>
>> MZTools has been used by lots of people for many years,
>> don't let one bad experience put you off using THE most
>> useful tool available to VB programmers.
>
>2nd most useful tool ;-) Here's THE most useful....
>
>CodeSMART 2005 for VB6 - Screenshots
>http://www.axtools.com/products/cs2k3vb_screenshots.htm
>
>..check out how it connects If/Then/Else, etc, with "Branch Lines".... very
>cool. Click on the "If" and it jumps to the "End If" too. Extremely cool <g>
>Did I mention that it's very cool? ;-) Then, check out the project explorer.
>Shows all procedures/events/apis/etc/etc (all optional)

MZTools is about $189 cheaper though ;-)



Jan Hyde (VB MVP)

--
A grenade thrown into a kitchen in France would result in
Linoleum Blownapart.

[Abolish the TV Licence - http://www.tvlicensing.biz/]
Author
11 May 2005 2:29 PM
Tim Baur
MZTools is da bomb.  Give it a try, you'll love it.  When you start using
all of it's features, don't forget to send the developer a few bucks.  He
earned it.

Your alternative is to write your own add-in, which is what MZTools is.

Show quote
"=?Utf-8?B?cm1zdGVybGluZw==?=" <rmsterl***@avaya.com> wrote in
news:FBB8797D-04D6-42AA-A162-7D995CC6B8E0@microsoft.com:

> Sorry but I have bad experiences using Error Handler inserter
> programs. I do not wish to use one.
>
> Given the code I have is there another way of achieving what I want?
>

AddThis Social Bookmark Button