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. Windows Forms
  4. Any way to get all TreeNodes in a TreeView have the '+' symbol?

Any way to get all TreeNodes in a TreeView have the '+' symbol?

Scheduled Pinned Locked Moved Windows Forms
data-structuresquestion
5 Posts 3 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.
  • J Offline
    J Offline
    jeffb42
    wrote on last edited by
    #1

    I'm dynamically populating a tree as the user selects nodes. Prior to clicking on a node, parent nodes actually have no children and after click, they get populated. This results in expandable nodes not having the "plus" sign next to it until after you click on it. Anyone got any ideas on smart ways to make every node have a plus sign, whether it has a child or not? Thanks, Jeff

    L D 2 Replies Last reply
    0
    • J jeffb42

      I'm dynamically populating a tree as the user selects nodes. Prior to clicking on a node, parent nodes actually have no children and after click, they get populated. This results in expandable nodes not having the "plus" sign next to it until after you click on it. Anyone got any ideas on smart ways to make every node have a plus sign, whether it has a child or not? Thanks, Jeff

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      jeffb42 wrote:

      Anyone got any ideas on smart ways to make every node have a plus sign, whether it has a child or not?

      Ownerdraw

      1 Reply Last reply
      0
      • J jeffb42

        I'm dynamically populating a tree as the user selects nodes. Prior to clicking on a node, parent nodes actually have no children and after click, they get populated. This results in expandable nodes not having the "plus" sign next to it until after you click on it. Anyone got any ideas on smart ways to make every node have a plus sign, whether it has a child or not? Thanks, Jeff

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Easy. Give every node a "dummy" child. When a node is expanded, you check the children of the node for the "dummy" child node. If it's there, remove it and populate the children as you see fit.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        J 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Easy. Give every node a "dummy" child. When a node is expanded, you check the children of the node for the "dummy" child node. If it's there, remove it and populate the children as you see fit.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          J Offline
          J Offline
          jeffb42
          wrote on last edited by
          #4

          Thanks Dave, I was hoping there was a bit easier way, but this sounds reasonable. Thanks, Jeff

          D 1 Reply Last reply
          0
          • J jeffb42

            Thanks Dave, I was hoping there was a bit easier way, but this sounds reasonable. Thanks, Jeff

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            jeffb42 wrote:

            I was hoping there was a bit easier way, but this sounds reasonable.

            Not that I've found. That's about as easy as it gets.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            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