Why would this code not work?
Private Sub TreeView1_BeforeCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeView1.BeforeCheck
Dim nd As TreeNode
For Each nd In TreeView1.SelectedNode.Nodes
Debug.Write(nd.FullPath)
Next
nd = Nothing
End Sub
End Class
Now in the debug window if I do:
Debug.Write(nd.FullPath)
Debug.Write(nd.Text)
Debug.Write(nd.Checked)
I get the correct information, however, if I change "Debug.Write(nd.FullPath)" to nd.checked = true I get the following error:
"An unhandled exception of type 'System.StackOverflowException' occurred in system.windows.forms.dll"
I've got a recursive search function that works great, but it iterates through all nodes. I'm trying to do it this way because this method iterates through only the direct childern of the parent and not every child including there children and childrens children, etc, etc.
Private Sub TreeView1_BeforeCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeView1.BeforeCheck
Dim nd As TreeNode
For Each nd In TreeView1.SelectedNode.Nodes
Debug.Write(nd.FullPath)
Next
nd = Nothing
End Sub
End Class
Now in the debug window if I do:
Debug.Write(nd.FullPath)
Debug.Write(nd.Text)
Debug.Write(nd.Checked)
I get the correct information, however, if I change "Debug.Write(nd.FullPath)" to nd.checked = true I get the following error:
"An unhandled exception of type 'System.StackOverflowException' occurred in system.windows.forms.dll"
I've got a recursive search function that works great, but it iterates through all nodes. I'm trying to do it this way because this method iterates through only the direct childern of the parent and not every child including there children and childrens children, etc, etc.