[RESOLVED] Determine check only one node at parent
Hi all,
I created a treeview that's only allowed user check on only one node at all parent. Below is my code.
VB Code:
Dim CheckOnlyOne As Node
'checked
k = 0
Set CheckOnlyOne = Node.FirstSibling
j = 0
If CheckOnlyOne.Checked = True Then
Do Until CheckOnlyOne Is Nothing
If CheckOnlyOne.Parent Is Nothing Then
If CheckOnlyOne.Checked = True Then
j = j + 1
End If
End If
If j > 1 Then
MsgBox "Can select one department only", vbCritical, "Error to select department"
Node.Checked = False
Exit Sub
End If
Set CheckOnlyOne = CheckOnlyOne.Next
Loop
End If
The problem is when running debug with breakpoint the node is successfully to unchecked.However, when debugging end the node was checked back.
How to solve my problem ?
Thanks in Advance.
Re: Determine check only one node at parent
Is this right?
Node.Checked = False
Shouldnt this be
CheckOnlyOne.Checked = False
:confused:
Re: Determine check only one node at parent
I changed already, but still cannot ... it will unchecked the previous node instead of current node
Re: Determine check only one node at parent
What does your function do?
Is it to make only one node checked for whole tree or one node checked for the current level?
Re: Determine check only one node at parent
I solved the problem.
I unchecked the item by using timer..
Thanks ZeeZee
Re: [RESOLVED] Determine check only one node at parent
:D.
Thats the only soultion I also could see.
It seems that current node being checked/unchecked cannot be undone.
And the Node is passed as ByVal also.
too bad :(
:wave: