View Full Version : i need to copy a text from tree to listbox
i need to copy a text from tree to listbox.
tChildrenOfNode1 = Tree.GetChildren("Tree1", "1.1.1.1");
result = ListBox.AddItem("ListBox1", tChildrenOfNode1);
TJ_Tigger
10-10-2005, 05:54 PM
i need to copy a text from tree to listbox.
tChildrenOfNode1 = Tree.GetChildren("Tree1", "1.1.1.1");
result = ListBox.AddItem("ListBox1", tChildrenOfNode1);
The Tree.GetChildren action returns a table containing all the children under the specified node. You will need to use a for loop to enumerate the table and add the items to your listbox.
tChildrenOfNode1 = Tree.GetChildren("Tree1", "1.1.1.1");
--Make sure there are children in the table
if tChildrenOfNode1 then
--for each child found add it to the list box with the text as the LB text and the NodeIndex as the data
for i,v in tChildrenOfNode1 do
ListBox.AddItem("ListBox1", tChildrenOfNode1[i]["Text"]
, tChildrenOfNode1[i]["NodeIndex"])
end
end
As a helpful hint, make sure to pay attention to what is returned by the action.
HTH
Tigg
i need to read only the text in node 1.1.1.1 in to a variable and put it into a listbox
TJ_Tigger
10-11-2005, 06:56 AM
i need to read only the text in node 1.1.1.1 in to a variable and put it into a listbox
Use the Tree.GetNode action instead.
Tigg
i use this code
tChildrenOfNode1 = Tree.GetNode("Tree1", "1.1.1.1");
result = ListBox.AddItem("ListBox1", tChildrenOfNode1);
and get error messeg - must be of type string -
TJ_Tigger
10-11-2005, 08:50 AM
Exactly because the Tree.GetNode returns a table and not a string. You need to specify which column of data you want from the returned table.
tChildrenOfNode1 = Tree.GetNode("Tree1", "1.1.1.1");
result = ListBox.AddItem("ListBox1", tChildrenOfNode1.Text, "1.1.1.1");
Tigg
Thank you Thank you Thank you....
Powered by vBulletin™ Version 4.0.6 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.