By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,569 Members | 1,386 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,569 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
* "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 discussion thread is closed

Replies have been disabled for this discussion.