|
-
Jul 8th, 2010, 02:36 PM
#2
Frenzied Member
Re: Variable Question: Use variable value to set another variable of that values name
 Originally Posted by Mythos44
Okay here's my question.
How would I use a variables value to be used to set or get another variables value?
Here's an example.
Let's say I have 3 variables but actually have many more
House = "Big"
Car = "Fast"
Pet = "Dog"
Now I have a function that queries a table to get some data and one of the fields is a variable name such as Pet
something like
VariableCheck = GetVariableFieldValue() // This returns Pet
so VariableCheck = Pet
So rather than having a Huge select case statement such as:
Select Case VariableCheck
Case "House"
txtValue.text = House
Case "Car"
txtValue.Text = Car
Case "Pet"
txtValue.Text = Pet
End Select
I need some kind of varValueVariable function.
txtValue.Text = VarValueOf(VariableCheck)
and a set value of vunction
SetVarValueOf(VariableCheck) = "Cat"
Thanks for all your help
Um, if your GetVariableFieldValue() function returns "Pet", and you want to set a textbox value equal to that string, you don't need a switch statement, just do
Code:
txtValue.Text = VariableCheck
Likewise for setting it's value, you would do:
Code:
VariableCheck = "Cat"
Unless I just don't get it...
Justin
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
|