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

  • Thread starter Christian Blackburn
  • Start date
C

Christian Blackburn

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
 
C

Christian Blackburn

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
 
H

Herfried K. Wagner [MVP]

* "Christian Blackburn said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top