I think my example might have been too simple and I did not explain enough.
I have a tabControl with a treeView on each tab.
Each tree will have a name like treeXXXXX (see names() in code sample). There is a data file for each tree with the same name as the tree.
I will read a text file for each tree to get the data to populate the trees.
The code is more like this: (I am new to VB. I realize my read & loop code is not correct. I am only interested in how to assign the string variable to the control name.)
- names(1)='treeOrders'
-
names(2)='treeProducts'
-
names(3)='treeInvoices'
-
for i = 1 to 3
-
read stuff from files, names(i)
-
tv='frmMainMenu.' & names(i) '<-- this needs to be the name of the tree
-
for j = 1 to lines.in.stuff
-
tv.node.add=stuff(j) '<-- this is probably my big problem
-
next j
-
next i
So...
line 6 creates a string with the name of the control.
something prior to line 8 has to convert the string "tv" to a control.name.
The ability to do this is key to my application. I assume I can do things like:
nm="TxtName"
nm.text='Jim'
This will obviously not work either because nm is a string, not a control. I think the solution to the code sample will give me the answer to this and other similar needs.
Thanks. (Sorry to be so verbose!)