Question : How do I check all checkboxes in a .Net Winforms TreeView Control?

Hi:

I'm trying to "Check All" the nodes in a .Net Winforms Treeview control.
I've tried looping through and setting the the Checked property on each node.
The property is getting correctly set to "true."
However, the treenodes don't update in the form to show the correct state.

What am I missing here?

Thanks,
JohnB

Answer : How do I check all checkboxes in a .Net Winforms TreeView Control?

Try following code
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Private Sub CheckUncheckAll(ByVal ND As TreeNode, ByVal blnCheck As Boolean) 
    ND.Checked = blnCheck
    For Each ndChild As TreeNode In ND.Nodes
      If ndChild.Nodes.Count > 0 Then
        CheckUncheckAll(ndChild, blnCheck)
      End If
    Next 
  End Sub
Random Solutions  
 
programming4us programming4us