I’m trying to store the names of some variables inside strings. For example:
Dim Foo1 as Integer Dim Foo1Name as String ' -- Do something to set Foo1Name to the name of the other variable -- MessageBox.Show(Foo1Name & ' is the variable you are looking for.') ' Outputs: ' Foo1 is the variable you are looking for.
This would help with some debugging I’m working on.
Well, you can clearly just set Foo1Name = ‘Foo1’ – but I strongly suspect that’s not what you’re after.
How would you know which variable you’re trying to find the name of? What’s the bigger picture? What you want may be possible with reflection, if we’re talking about non-local variables, but I suspect it’s either not feasible, or there’s a better way to attack the problem in the first place.