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:
  1. Dim CheckOnlyOne As Node
  2. 'checked
  3. k = 0
  4. Set CheckOnlyOne = Node.FirstSibling
  5. j = 0
  6. If CheckOnlyOne.Checked = True Then
  7.     Do Until CheckOnlyOne Is Nothing
  8.         If CheckOnlyOne.Parent Is Nothing Then
  9.             If CheckOnlyOne.Checked = True Then
  10.                 j = j + 1
  11.             End If
  12.         End If
  13.         If j > 1 Then
  14.            
  15.             MsgBox "Can select one department only", vbCritical, "Error to select department"
  16.             Node.Checked = False
  17.             Exit Sub
  18.         End If
  19.         Set CheckOnlyOne = CheckOnlyOne.Next
  20.     Loop
  21. 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.