473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can I detect the name of the variable received by a procedure?

Hi Gang,
Can someone show me how to detect the name of the variable received by a
procedure? I'd really appreciate it. I would like the following code to
detect the name of the strStupid variable and output the string:

'-----------------------------------------------------------------------
Private Sub Form_Load()
Dim strStupid As String

MsgBox "NameOf strStupid" & varname(strStupid)
End Sub
'-----------------------------------------------------------------------

I realize that functionally in a program there are a trillion ways to
workaround the need to know the variable name, but I want to know if you can
just detect it too.
Thanks in Advance,
Christian Blackburn
Nov 20 '05 #1
2 1004
Hi Gang,
Woops looks like I posted this to the .Net group please disregard as I know
how to do this in .net, but I'm trying to do it in VB6.
Thanks any ways,
Christian Blackburn
"Christian Blackburn" <Ch*****************@Damn.Spam@Hotmail.com> wrote in
message news:uW**************@tk2msftngp13.phx.gbl...
Hi Gang,
Can someone show me how to detect the name of the variable received by a
procedure? I'd really appreciate it. I would like the following code to
detect the name of the strStupid variable and output the string:

'-----------------------------------------------------------------------
Private Sub Form_Load()
Dim strStupid As String

MsgBox "NameOf strStupid" & varname(strStupid)
End Sub
'-----------------------------------------------------------------------

I realize that functionally in a program there are a trillion ways to
workaround the need to know the variable name, but I want to know if you can just detect it too.
Thanks in Advance,
Christian Blackburn

Nov 20 '05 #2
* "Christian Blackburn" <Ch*****************@Damn.Spam@Hotmail.com> scripsit:
Can someone show me how to detect the name of the variable received by a
procedure? I'd really appreciate it. I would like the following code to
detect the name of the strStupid variable and output the string:

'-----------------------------------------------------------------------
Private Sub Form_Load()
Dim strStupid As String

MsgBox "NameOf strStupid" & varname(strStupid)
End Sub
'-----------------------------------------------------------------------

I realize that functionally in a program there are a trillion ways to
workaround the need to know the variable name, but I want to know if you can
just detect it too.


AFAIS that's impossible for local variables, in both, VB.NET and VB
Classic.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: selowan | last post by:
Hi, In VB6 Pro SP5, I have a form that contains an MSFlexGrid and a few other textboxes and comboboxes. I am using the technique from MSDN article Q241355, which describes how to tab and edit in...
22
by: nobody | last post by:
hello everybody, is there a way of creating an array with help of a function that would accept the name of this array as a parameter and then create global Array type variable of that name? so...
2
by: John Bentley | last post by:
I have two tasks that I expect will be straight forward to anyone with reflection skills. 1. To return the the name of an object instance (not type) determined at run time. For example, I...
3
by: Hardy Wang | last post by:
Hi, I have a HttpModule in my ASP.NET application, in AuthorizeRequest event, I want to detect if page is posted back. Is there a way? using System; using System.Web; namespace MyModule {...
4
by: Tom Vukovich | last post by:
Hi All, I have an application that I am porting from VB6 to VBNet and in vb6 i can detect the unloadMode. DotNet doesn't support this but I need the functionality. I understand the code should be in...
10
by: CJM | last post by:
I'm trying to call a package/procedure in oracle (from an ASP page) which requires a number of parameters. I have got this working using OO40 but unfortunately the transaction rollback function...
1
by: =?Utf-8?B?QmlzaG95?= | last post by:
Hi all, I have an asp.net 2.0 web site with a DetailsView control to select and insert data from database. I made the insert statement for that DetailsView by a stored procedure. I made some...
13
by: Neil | last post by:
Can I get the name of a procedure from within the procedure? In my error handler, I write the error to an error table. I'd like to write the name of the procedure that's writing the error. But,...
3
by: dmorand | last post by:
I'm very new to stored procedures so this is probably something very dumb. I want to pass a name of a table to be created to my stored procedure. I'm using the variable @tableName in the code below...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.