Add new property to TreeNode
-
language : visual basic .net overview : TreeView control is composed by nodes collection which is the TreeNode object. every TreeNode object have some property(ex: Tag Property). these property can be use in the tree view event like Treeview_AfterSelect event(ex: e.node.tag) Wanted : make the second Tag property. i have already try to make a class which inherits from the treenode class and add a property (say : Tag2 property) but when i use the Treeview_afterSelect event, i can't find my Tag2 property using the e.node.(property). i assume this is because the e variable in this event is define as System.Windows.Forms.TreeViewEventArgs (as indicated in the event declaration : Private Sub TV_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TV.AfterSelect) which don't have the Tag2 property Question : how can i make the tag2 property which can be accessed in the TreeView Events just like the Tag property does. (please give the detail step by step) Thanks.
-
language : visual basic .net overview : TreeView control is composed by nodes collection which is the TreeNode object. every TreeNode object have some property(ex: Tag Property). these property can be use in the tree view event like Treeview_AfterSelect event(ex: e.node.tag) Wanted : make the second Tag property. i have already try to make a class which inherits from the treenode class and add a property (say : Tag2 property) but when i use the Treeview_afterSelect event, i can't find my Tag2 property using the e.node.(property). i assume this is because the e variable in this event is define as System.Windows.Forms.TreeViewEventArgs (as indicated in the event declaration : Private Sub TV_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TV.AfterSelect) which don't have the Tag2 property Question : how can i make the tag2 property which can be accessed in the TreeView Events just like the Tag property does. (please give the detail step by step) Thanks.
You need to cast thee treenode object that comes in e.node to your object. e.g. Dim vExtendedNode as MyNode vExtendedNode=CType(e.node,MyNode) Hope this helps... Free your mind...