Migrating from VB6 to .NET, is there an equivlaent function for TreeNode.FirstSibling?
-
09-09-2019 - |
Question
The desktop application I'm migrating makes heavy use of a treeview control, and many calls to TreeNode.FirstSibling
, e.g.
'UPGRADE_ISSUE: MSComctlLib.Node property tvTreeView.SelectedItem.FirstSibling was not upgraded.
If tvTreeView.SelectedNode.FirstSibling.Index = 1 Then
...
End If
Is there an equivalent function to use?
Solution
Well to have a sibling it has to have a parent, so you could do
myTreeNode.Parent.FirstNode
Or you could do
myTreeNode.Parent.Nodes[0]
EDIT: and for last sibling:
myTreeNode.Parent.LastNode
OTHER TIPS
I could be wrong but isn't "FirstChild", or FirstParent. Alternatively, NextNode, which should iterate through siblings.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow