Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim cnt As Integer = trv.Nodes.Count - 1 For i As Integer = cnt To 0 Step -1 For Each nd As WinForm.TreeNode In trv.AllNodes If nd.Level = e.Node.Level AndAlso nd.FullPath <> e.Node.FullPath Then trv.Nodes(i).CollapseAll() End If Next e.Node.Expand() Next