In hunting down a problem I created a simple form.
Public Class Form1
Private mOne As TreeNode
Private mTwo As TreeNode
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
LoadNodesA()
'LoadNodesB()
End Sub
Private Sub LoadNodesA()
mOne = TreeView1.Nodes.Add("One")
mTwo = TreeView1.Nodes.Add("Two")
TreeView1.SelectedNode = mTwo
End Sub
Private Sub LoadNodesB()
Dim nodes(1) As TreeNode
nodes(0) = New TreeNode("One")
mOne = nodes(0)
nodes(1) = New TreeNode("Two")
mTwo = nodes(1)
TreeView1.Nodes.AddRange(nodes)
TreeView1.SelectedNode = mOne
End Sub
End Class
The behaviour I wanted is given by LoadNodesA(). LoadLoadsB() gives a
different result. Can someone explain why the difference arises and why it is
meant to happen this way?
Thanks for any comments.
Hayrob
hayrob - 26 Jul 2006 15:10 GMT
Please ignore - i'm an idiot.
Hayrob
> In hunting down a problem I created a simple form.
>
[quoted text clipped - 40 lines]
>
> Hayrob