Paul,
I'm not sure why you're having a problem with #1. I have successfully checked all child nodes without expanding. I'm using C#, but I wouldn't think that there's a difference in functionality there between C# and VB (I could be wrong).
As far as #2 goes, unfortunately, I think you will have to "walk the tree" to find the checked Nodes. I suggest sub-classing the TreeView control and creating a CheckedNodes collection. Shouldn't be too difficult to implement.
~~Bonnie
>I am working on a treeview control with check boxs to display Folders and Files for an FTP program to use as its selection and have 2 problems.
>
>1.) I want to be able to check all child nodes when a parent node is checked, however using the code below I must expand all nodes to get it to work. So the code below works but isnt very appealing.
>
> Private Sub DirectoryTreeView_AfterCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles MyBase.AfterCheck
>
> ' for some reason I have to Expand all child nodes to get them checked
> e.Node.ExpandAll()
> Dim onode As TreeNode
> For Each onode In e.Node.Nodes
> onode.Checked = True
> Next
> End If
>
>
>
>2) Is there a method to tell what has been checked similar to the checked list box? I would hate to have to loop through the entire treeview to check for checked :)
>
>I appreciate any help
>
>Paul