custom treeview
-
I've created a my own node class that inherits from treenode and included some extra properties. When I try and add one to a normal treeview, my custom properties are gone. Here is what I do: Dim temp as new myNode() with temp 'set some properties End with treeview1.nodes.add(temp) 'I'm assuming that here it gets converted to a normal node. To get around this, I tried to make a custom TreeNodeCollection, but the IDE gives me problems with sub new. To see the errors, copy this: Public Class myCol Inherits TreeNodeCollection '... End Class I would greatly appriciate any help. -Steve
-
I've created a my own node class that inherits from treenode and included some extra properties. When I try and add one to a normal treeview, my custom properties are gone. Here is what I do: Dim temp as new myNode() with temp 'set some properties End with treeview1.nodes.add(temp) 'I'm assuming that here it gets converted to a normal node. To get around this, I tried to make a custom TreeNodeCollection, but the IDE gives me problems with sub new. To see the errors, copy this: Public Class myCol Inherits TreeNodeCollection '... End Class I would greatly appriciate any help. -Steve
Hi, When your going to retrieve the TreeNode you'll have to cast it to the right object-type like - Custom node-class = TreeNodeEx
Private Sub TreeNode1_Click(sender as object, e as TreenodeEventArgs) ... Dim MyTreeNodeEx As TreeNodeEx MyTreeNodeEx = CType(e.Nodes.SelectedNode, TreeNodeX) ... End Sub
This is what I'm doing when using the treeview with custom nodes. I hope this answers your question. Greets, Poolbeer Sorry no sigh yet