Dim tr As WinForm.TreeView
Dim nd As WinForm.TreeNode
Dim fnd As WinForm.TreeNode
tr = Forms("窗口1").Controls("TreeView1")
nd = tr.SelectedNode
fnd = nd.ParentNodeIf fnd IsNot Nothing Then If fnd.Nodes.Count = 1 Then fnd.DataRow("是否末级") = True End IfEnd Ifnd.DataRow.DataTable.DeleteFor("tree = '" & nd.DataRow("tree") & "' or tree like '" & nd.DataRow("tree") & ".%'")nd.Delete