|
-
Jun 9th, 2001, 07:52 PM
#1
Evaluating Variables
Is it possible to force evaluation of variables.
Example:
strItem = "Index"
Node.strItem
Obviously strItem is not a property or method of the Node object, the value of strItem is. Is there a way to evaluate that line so that I actually get Node.Index?
-Steve
-
Jun 9th, 2001, 07:58 PM
#2
You can use a variable to reference a member of a collection, like the Nodes collection. You can use either a numeric variable, which VB will interpret as the Index property or a string variable which will be interpreted as the Key property:
Code:
TreeView1.Nodes(strMyKey)
"It's cold gin time again ..."
Check out my website here.
-
Jun 9th, 2001, 08:14 PM
#3
Steve,
If Bruce's answer doesn't fufill your needs try this.
The way I would approach it would be to take the string and just use a select statement to figure out which one you want and then reference the correct property or method.
Hope this helps,
-
Jun 9th, 2001, 08:19 PM
#4
Put this code in a Class module.
VB Code:
Public Property Get strItem() As Integer
strItem = sItem
End Property
Public Property Let strItem(ByVal vNewValue As Integer)
sItem = vNewValue
End Property
And in a form:
VB Code:
Private Sub Form_Load()
Dim Node As Class1
Set Node = New Class1
Node.strItem = 0
MsgBox Node.strItem
Set Node = Nothing
End Sub
-
Jun 9th, 2001, 08:27 PM
#5
Matthew,
I dont think thats what he was asking, I think he wanted to know how do do something like this.
Code:
strItem="Caption"
Me.stritem = "This is my new caption"
but then again I could be wrong.
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
|