Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating from VB6 to .NET, is there an equivalent function for TreeNode.FirstSibling?

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?

like image 942
brasskazoo Avatar asked Feb 26 '09 23:02

brasskazoo


1 Answers

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
like image 60
Neil N Avatar answered Nov 14 '22 03:11

Neil N