Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 15th, 2006, 06:20 AM
Registered User
 
Join Date: Jun 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default SUB NAME IN VB6

Hi, let's say I'm in a 'Command4_Click()' sub.

Is it any possible way how I may get that name known in my code?

I may get form name via Me.name - that works. Good to know if it is possible to get sub name...

Alex



Alex
 
Old June 15th, 2006, 04:13 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

There is no way.
When I have wanted to know this, I have had to add a global variable, and upon entering the sub, 1st thing:
Code:
Private Sub Command4_Click()
    gstrSubName = "Command4_Click()"
    ' More code . . .
End Sub
When code is compiled, all sub names, variable names. etc, are eliminated and turned into more machine-compatible tokens, which later get turned into specific addresses.
 
Old June 21st, 2006, 03:30 AM
Registered User
 
Join Date: Jun 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by BrianWren
 There is no way.
When I have wanted to know this, I have had to add a global variable, and upon entering the sub, 1st thing:
Code:
Private Sub Command4_Click()
    gstrSubName = "Command4_Click()"
    ' More code . . .
End Sub
When code is compiled, all sub names, variable names. etc, are eliminated and turned into more machine-compatible tokens, which later get turned into specific addresses.
Brian, I want to share what I have found regarding that. Here is a link of add-ins I use and it works great! It adds error handling to the sub or even module. Puts first some classes. All works for me 100%. Very good free software. I think any VB6 programmer must use that.
http://www.bdcsoftware.com/blog/entr...ddErrorHandler

Just wanted to help because I have found it. And when that script makes a code it puts a sub name as a parameter automatically. That is a dream really. No more crashes. 24/7 !!! :)


Alex





Similar Threads
Thread Thread Starter Forum Replies Last Post
COM Implementation using VB6 haianoop Pro VB 6 0 December 28th, 2005 04:01 PM
VB6 how to use a COM+ pevl VB Components 3 November 26th, 2005 09:16 AM
VB6 How to minhtri VB How-To 2 September 30th, 2004 06:08 AM
Where to get VB6 HaXXeD Beginning VB 6 2 December 5th, 2003 04:21 PM
VB6 ?? wickman Wrox Book Feedback 1 June 5th, 2003 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.