Private Function 再帰(node As TreeNode) As TreeNode Return If(node?.Parent Is Nothing, node, 再帰(node.Parent)) End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim target As TreeNode = TreeView1.Nodes(0).Nodes(0).Nodes(0) Dim root1 As TreeNode = 再帰(target) End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim target As TreeNode = TreeView1.Nodes(0).Nodes(0).Nodes(0).Nodes(0) Dim root1 As TreeNode = If(target?.Parent Is Nothing, target, 再帰(target.Parent)) End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim target As TreeNode = TreeView1.Nodes(0).Nodes(0).Nodes(0).Nodes(0) Dim root1 As TreeNode = If(target?.Parent Is Nothing, target, If(target.Parent?.Parent Is Nothing, target.Parent, 再帰(target.Parent.Parent))) End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim target As TreeNode = TreeView1.Nodes(0).Nodes(0).Nodes(0).Nodes(0) Dim root1 As TreeNode = If(target?.Parent Is Nothing, target, If(target.Parent?.Parent Is Nothing, target.Parent, If(target.Parent.Parent?.Parent Is Nothing, target.Parent.Paret, 再帰(target.Parent.Parent.Parent)))) End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim target As TreeNode = TreeView1.Nodes(0).Nodes(0).Nodes(0).Nodes(0) Dim root1 As TreeNode = If(target?.Parent Is Nothing, target, If(target.Parent?.Parent Is Nothing, target.Parent, target.Parent.Parent)) End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim target As TreeNode = TreeView1.Nodes(0).Nodes(0).Nodes(0).Nodes(0) Dim root1 As TreeNode = If(target?.Parent Is Nothing, target, target.Parent.Parent)) End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim target As TreeNode = TreeView1.Nodes(0).Nodes(0).Nodes(0).Nodes(0) Dim root1 As TreeNode = target.Parent.Parent End Sub