B
bclegg
Hi,
When I implement the example code it errors with
'No parameterless constructor defined for this object.'
experimenting with dim o as object = mytreenode.clone() gives the same
error.
The example code is:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim lastNode As TreeNode
lastNode = tvAvailable.Nodes(tvAvailable.Nodes.Count - 1). _
Nodes(tvAvailable.Nodes(tvAvailable.Nodes.Count -
1).Nodes.Count - 1)
' Clone the last child node.
Dim clonedNode As TreeNode = CType(lastNode.Clone(),
TreeNode)******Error HERE**************
' Insert the cloned node as the first root node.
tvAvailable.Nodes.Insert(0, clonedNode)
MessageBox.Show(lastNode.Text & _
" tree node cloned and added to " & tvAvailable.Nodes(0).Text)
End Sub
Is this method flawed? Does anybody have working code for copying a
treenode from one tree to another?
Thanks
Bob
When I implement the example code it errors with
'No parameterless constructor defined for this object.'
experimenting with dim o as object = mytreenode.clone() gives the same
error.
The example code is:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim lastNode As TreeNode
lastNode = tvAvailable.Nodes(tvAvailable.Nodes.Count - 1). _
Nodes(tvAvailable.Nodes(tvAvailable.Nodes.Count -
1).Nodes.Count - 1)
' Clone the last child node.
Dim clonedNode As TreeNode = CType(lastNode.Clone(),
TreeNode)******Error HERE**************
' Insert the cloned node as the first root node.
tvAvailable.Nodes.Insert(0, clonedNode)
MessageBox.Show(lastNode.Text & _
" tree node cloned and added to " & tvAvailable.Nodes(0).Text)
End Sub
Is this method flawed? Does anybody have working code for copying a
treenode from one tree to another?
Thanks
Bob