dotnet treeview, how to find the node index from treenode text?
I'm still learning dotnets with maxscript and as the title said I need to understand how to find node's index from treenode's text.
first, I tried this code
and it gave me undefined
then I changed the string to a variable,
str=dotNetObject "System.String" "SomeName" tv.nodes.item[str].index
where tv is dotnet treeview and I'm sure that
And this is the third way I tried and what I'm currently using,
local index for i=0 to tv.nodes.count-1 do (if tv.nodes.item[i].text=="SomeName" then index=i )
the loop way works but looks weird, eventhough it is impossible to have a duplicate name in my nodes.
or did i do a mistake in a 1st/2nd methods?
or I misunderstood this:
tv.nodes is a
and has properties:
.Count : <System.Int32>, read-only .IsReadOnly : <System.Boolean>, read-only .Item[<System.Int32>index] : <System.Windows.Forms.TreeNode> .Item[<System.String>key] : <System.Windows.Forms.TreeNode>, read-only
and in TreeNodeCollection.Item Property(String), it said that key parameter is The "name" of the TreeNode to retrieve from the collection.
I'm confused enough for this little thing, help me please...
thank you and cheers :D