Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
200
TreeNode bug
posted

I get a system.arguentoutofrange exception with the following code.  Both conditional statements, unselecting and clearing, give this error.  If this were true the conditional statements would never let me get to that point.  This occurs when I have a form with a tree, I go to a dialgoue form where user can change the heirachry of the tree(save in a xml file) then upon closing the dialgue, I want to clear the tree on original page and rebuild from updated xml heirarchy file.  This seems to be a bug in your software.....

If Me.tvwReports.SelectedNodes.Count > 0 Then

If Not tvwReports.SelectedNodes(0) Is Nothing Then

Me.tvwReports.SelectedNodes(0).Selected = False

End If

End If

If tvwReports.Nodes.Count > 0 Then

Dim i As Integer = 0
While i <= tvwReports.Nodes.Count

tvwReports.Nodes(i).Remove()

i = i + 1

End While

End If