Dim trv As WinForm.TreeView = e.form.controls("TreeView1") For Each nd As WinForm.TreeNode In trv.Nodes Dim count = 0 For Each cnd As WinForm.TreeNode In nd.nodes If cnd.Checked Then If cnd.name = "分校校长" OrElse cnd.name = "分校主管" Then count += 1 End If End If Next If count >= 2 Then msgbox("不能同时选中") Return End If Next