|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VB6 - Pass current Procedure Name to Error Handling RoutineUsing 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 "rmsterling" <rmsterl***@avaya.com>'s wild thoughts were released on Wed, 11 May 2005 05:14:01 -0700 bearing thefollowing fruit: Show quote >Subject: VB6 - Pass current Procedure Name to Error Handling Routine Get MZTools Version 3> >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. > 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) 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/] > > "rmsterling" <rmsterl***@avaya.com> wrote in message A) Learn to search newsgroups. This question comes up quite often. news:FBB8797D-04D6-42AA-A162-7D995CC6B8E0@microsoft.com... > Given the code I have is there another way of achieving what I want? 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. 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. > > "Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in message Wow. It took almost two days for someone to respond to that. I'm almost 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. disappointed in the group.... (And next time the question comes up I'll STILL say there's no way to do it....) "rmsterling" <rmsterl***@avaya.com>'s wild thoughts were released on Wed, 11 May 2005 05:34:01 -0700 bearing thefollowing fruit: >Sorry but I have bad experiences using Error Handler inserter programs. I do MZTools has been used by lots of people for many years,>not wish to use one. 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: Jan Hyde (VB MVP)> >> "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/] >> >> -- Migration: A headache birds get when they fly down for the winter. (Richard Lederer) [Abolish the TV Licence - http://www.tvlicensing.biz/] "Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message 2nd most useful tool ;-) Here's THE most useful....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. 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.. "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com>'s wild thoughts were released on Wed, 11 May 2005 07:31:25 -0700bearing the following fruit: Show quote >"Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message MZTools is about $189 cheaper though ;-)>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) 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/] 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? > |
|||||||||||||||||||||||