Freaky Treeview Checkbox Thing
I am trying to get the users confirmation when clicking a checkbox in the treeview control.
Code snippet:
Code:
Sub treeGuideline_NodeCheck(ByVal Node As MSComctlLib.Node)
If Node.Children > 0 Then 'Parent
msgreturn = MsgBox("Checking this node will select all sections and guidelines below it. Do you wish to continue?", vbYesNo + vbQuestion)
' If msgreturn = vbNo Then
' Node.Checke= False '***
' Else
' bDirty = True
'All the work done when checking/unchecking is done in the
'following 2 subs.
CheckNodes frmTree.treeGuideline, Node, Node.Checked, True
checkforsiblings frmTree.treeGuideline, Node, Node.Checked
' End If
End if
' some other stuff
End Sub
In debug mode, I can see the checkbox clear when the line *** is executed, but at the end of the sub, the check box rechecks itself. Nothing I do inside the sub, as far as checking/unchecking is persistent, when the sub ends, it sets the value to whatever was going to be when the user clicked. Is there any way to cancel a checkbox click?
Re: Freaky Treeview Checkbox Thing
Quote:
Originally posted by a2427
VB Code:
Sub treeGuideline_NodeCheck(ByVal Node As MSComctlLib.Node)
If Node.Children > 0 Then 'Parent
msgreturn = MsgBox("Checking this node will select all sections and guidelines below it. Do you wish to continue?", vbYesNo + vbQuestion)
' If msgreturn = vbNo Then
' Node.Checke= False '***
' Else
' bDirty = True
'All the work done when checking/unchecking is done in the
'following 2 subs.
CheckNodes frmTree.treeGuideline, Node, Node.Checked, True
checkforsiblings frmTree.treeGuideline, Node, Node.Checked
' End If
End if
' some other stuff
End Sub
Are you sure thats the code you want debugged? All your code lines are commented out except for 5 of them, including your *** line. Also, Typo alert :Node.Checke= False
-Lou