Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Add new property to TreeNode

Add new property to TreeNode

Scheduled Pinned Locked Moved Visual Basic
questioncsharpdata-structurestutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cometz
    wrote on last edited by
    #1

    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.

    G 1 Reply Last reply
    0
    • C cometz

      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.

      G Offline
      G Offline
      Guillermo Rivero
      wrote on last edited by
      #2

      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...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups