或者
Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim nd As WinForm.TreeNode = tr.SelectedNode
If nd IsNot Nothing Then
If nd.Nodes.Count = 0 Then
Dim pth() As String = nd.FullPath.Split("\")
Select Case nd.Level
Case 0
DataTables("表A").DeleteFor("大类 = '" & pth(0) & "'")
Case 1
DataTables("表A").DeleteFor("大类 = '" & pth(0) & "' And 二类 = '" & pth(1) & "'")
Case 2
DataTables("表A").DeleteFor("大类 = '" & pth(0) & "' And 二类 = '" & pth(1) & "' And 三类 = '" & pth(2) & "'")
End Select
nd.Delete()
Else
msgbox("不能删除")
End If
End If
tr.Select()