VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Recursive function to check/uncheck all child Nodes in a TreeView

by Guy Sade (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 21st June 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Recursive function to check/uncheck all child Nodes in a TreeView

Rate Recursive function to check/uncheck all child Nodes in a TreeView



  TvNodeCheck Node.Child, Node.Children, Node.Checked
  
End Sub
Private Sub TvNodeCheck(ByRef Node As MSComctlLib.Node, ByRef ChildCount As Integer, CBvalue As Boolean)
Dim n As Integer
Dim CurNode As Node
  
  If ChildCount = 0 Then Exit Sub
    
  Set CurNode = Node
  
  For n = 1 To ChildCount
    If CurNode.Children > 0 Then TvNodeCheck CurNode.Child, CurNode.Children, CBvalue
    
    CurNode.Checked = CBvalue
    If n < ChildCount Then
      Set CurNode = CurNode.Next
    End If
  Next
  
End Sub


Download this snippet    Add to My Saved Code

Recursive function to check/uncheck all child Nodes in a TreeView Comments

No comments have been posted about Recursive function to check/uncheck all child Nodes in a TreeView. Why not be the first to post a comment about Recursive function to check/uncheck all child Nodes in a TreeView.

Post your comment

Subject:
Message:
0/1000 characters