0
我想检查我的树视图的根是否被检查。我不在乎孩子是否被检查。检查根是否被检查Treeview VBA
这是我的代码:
If (TreeView.Nodes.Count > 0) Then
Dim check As Boolean
check = False
Set nd = TreeView.Nodes(1).Root.FirstSibling
Do Until nd Is Nothing
If nd.Parent Is Nothing And (nd.Selected) Then
check = True
MsgBox " a root is checked !"
End If
Set nd = nd.Next
Loop
End If
If Not check Then
MsgBox "No root checked !"
End If
当没有选中任何代码工作。但是,当一个孩子检查它告诉我,根检查... 我真的不知道如何改变这一点!
如果nd.Parent一无所有,(nd.Checked)那么问题就来自这里 – tbille