Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") Dim nd As WinForm.TreeNode trv.Nodes.Clear trv.Nodes.Add("按钮","按钮") trv.Nodes.Add("数据表","数据表") trv.Nodes.Add("单选框","单选框") trv.Nodes.Add("复选框","复选框") nd = trv.Nodes(0) nd.nodes.Add("按钮1","按钮1") nd = trv.Nodes(1) nd.nodes.Add("数据表1","数据表1") Dim ls As new List(of object) For Each nd In trv.Nodes MessageBox.Show(nd.text & "=" & nd.Nodes.Count ) If nd.Nodes.Count = 0 Then ls.add(nd) End If Next For Each nd In ls nd.delete next
|