|
-
Jul 28th, 2004, 06:54 PM
#1
Thread Starter
Frenzied Member
Reading a variable whoose name is in another variable
Lets say I have
VB Code:
Type Step
x As Byte
y As Byte
up As Boolean
down As Boolean
left As Boolean
right As Boolean
End Type
Dim a As String
Dim cell22 As Step
cell22.x = 1
cell22.y = 5
cell22.up = True
cell22.down = False
cell22.left = False
cell22.right = True
a = "cell22"
how can I msgbox the variable whoose name is in a?
in JavaScript it would be: eval(a).x, but I know VB doesn't have eval(), so What can I do?
Have I helped you? Please Rate my posts. 
-
Jul 28th, 2004, 07:07 PM
#2
Thread Starter
Frenzied Member
OK. Now this question isn't urgent as I've found another way of solving the problem (using arrays). Still being curious though, how can this be done?
Have I helped you? Please Rate my posts. 
-
Jul 28th, 2004, 07:09 PM
#3
Addicted Member
Do you want to put the value of the variable that is contained in a in a msgbox or do u want to put put the name of the variable thats in a in a msgbox? I don't think that you would be able to put the value of the variable in because the variable is a string so if you did somthing like....
Then you would get the text from the variable... "Cell22"
So....unless theres another way that I am unaware of then its not possible to put the value of a variable thats contained in a variable in a msgbox.
-
Jul 28th, 2004, 07:25 PM
#4
Thread Starter
Frenzied Member
ok, well it's a good thing I thought to use arrays then.
Have I helped you? Please Rate my posts. 
-
Jul 28th, 2004, 07:38 PM
#5
The picture isn't missing
If you add the MS script control then you could do things like that, but it would have to be in the scope of the script.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|