I have this code in the AfterCollapse event of my TreeView control:-
I want the control to remove all sub-nodes after it has collapsed and then add a blank dummy one at the end.Code:Dim subNode As TreeNode For Each subNode In e.Node.Nodes MessageBox.Show("removing " & subNode.Text) subNode.Remove() Next e.Node.Nodes.Add("")
It falls over about half-way through with a "Object reference not set to an instance of an object" error.
It appears to be trying to remove the same sub-node twice!
Any ideas???


Reply With Quote