Results 1 to 6 of 6

Thread: [RESOLVED] Determine check only one node at parent

  1. #1

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Resolved [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:
    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.
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  2. #2
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Determine check only one node at parent

    Is this right?

    Node.Checked = False

    Shouldnt this be

    CheckOnlyOne.Checked = False

    IIF(Post.Rate > 0 , , )

  3. #3

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: Determine check only one node at parent

    I changed already, but still cannot ... it will unchecked the previous node instead of current node
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  4. #4
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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?
    IIF(Post.Rate > 0 , , )

  5. #5

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: Determine check only one node at parent

    I solved the problem.
    I unchecked the item by using timer..
    Thanks ZeeZee
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  6. #6
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: [RESOLVED] Determine check only one node at parent

    .
    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
    IIF(Post.Rate > 0 , , )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width