Hi
Making progress, but slowly. Current problem is trying to use a property as shown in the system help (shown below). When I try to use this to get the collection of checked nodes I get an error that says: CheckedNodes is not a member of 'System.Windows.Forms.TreeView'. Everything I have read points to this as being the way to get the collection, but yet, in the final analysis it doesn't do it!
I suppose this problem is related to the fact that it says Namespace is something to do with Web controls.
Question is: how do I get a collection of Checked checkboxes from my form based TreeView Do I need to iterate through and collect them Or, maybe there is an 'Imports' that I need to enable the use of this property
----------------------------------------------------------------
Note: This property is new in the .NET Framework version 2.0.
Gets a collection of TreeNode objects that represent the nodes in the TreeView control that display a selected check box.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
Visual Basic (Usage)
Dim instance As TreeView
Dim value As TreeNodeCollection
value = instance.CheckedNodes
Property Value
A TreeNodeCollection that contains the nodes in the TreeView that display a selected check box.

TreeView question #3
Mohamed Kishk
Hi NateV
Thank you very much for that.
The code does exactly as needed, and also illustrates another aspect of working with a TreeView for me to learn from.
I needed to change your MsgBox(node.Name) to MsgBox(node.Text), but other than that, your code worked brilliantly.
After a brief look at your code, and with my as yet limited understanding, I may be able to utilize some aspects to improve other parts of my code.
I'd also like to thank you for taking the time to write a very clear and helpful explanation.
PDagent
As you have indicated, the problem is related to the namespaces. I presume you are making a Windows Forms and, as such, all the form controls you are using are in the System.Windows.Forms namespace
Now, the extract from the help you have given shows that you are looking at a control in a different namespace (System.Web.UI.WebControls) and even though there are TreeView controls in both namespaces they possess different properties (as you have found).
The documentation that you should look at for your TreeView is something like this: http://msdn2.microsoft.com/en-us/system.windows.forms.treeview_members.aspx and as I saw there is no CheckedNodes property.
I don't think importing is an option because then you'd be using a web control on a Windows Form. I don't even know if that's possible or not as I've never tried it.
I am not aware of any property for the TreeView in System.Windows.Forms that is analogous to the CheckedNodes property for the TreeView in System.Web.UI.WebCotnrols.
I think iteration through the elements of the TreeView would be the most straightforward way of accomplishing your task. A little recursion is required though....Here's a function that returns a list of all selected nodes in a TreeView's node collection:
Function getCheckedNodes(ByVal nodeCollection As TreeNodeCollection) As List(Of TreeNode)
Dim checkedNodes As List(Of TreeNode) = New List(Of TreeNode)
For Each node As TreeNode In nodeCollection
If node.Checked Then
checkedNodes.Add(node)
End If
If node.Nodes.Count <> 0 Then checkedNodes.AddRange(getCheckedNodes(node.Nodes))
End If
Next
Return checkedNodes
End Function
And here's an example of calling it (TreeView1 is a TreeView control I dragged onto my Windows Form):
Dim x As List(Of TreeNode) = New List(Of TreeNode)
x = getCheckedNodes(TreeView1.Nodes)
MsgBox(x.Count.ToString()) 'Confirm the count of selected nodes is correct
For Each node As TreeNode In x 'Confirm the selected nodes is correct by displaying the name of each one
MsgBox(node.Name)
Next
Hope that helps a bit, but sorry if it doesn't