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. C#
  4. Populate TreeView node by clicking item in ListView

Populate TreeView node by clicking item in ListView

Scheduled Pinned Locked Moved C#
questionhelp
3 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.
  • M Offline
    M Offline
    MrColeyted
    wrote on last edited by
    #1

    Hello all. I am new here; a student of programming! I am developing an app similar to Windows Explorer. I have everything working great. But I have one question: Can anyone tell me what I may need to do to be able to click on a directory in the Listview and repopulate the Treeview in the left pane?:confused: Any help would be much appreciated!

    G 1 Reply Last reply
    0
    • M MrColeyted

      Hello all. I am new here; a student of programming! I am developing an app similar to Windows Explorer. I have everything working great. But I have one question: Can anyone tell me what I may need to do to be able to click on a directory in the Listview and repopulate the Treeview in the left pane?:confused: Any help would be much appreciated!

      G Offline
      G Offline
      Gareth H
      wrote on last edited by
      #2

      MrColeyted, Listen for the ListView.SelectedIndexChanged event. http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.onselectedindexchanged.aspx[^] Then do TreeView.Nodes.Add(WhatYouWantToAdd); http://msdn2.microsoft.com/en-us/library/system.windows.forms.treeview.aspx[^] Regards, Gareth.

      M 1 Reply Last reply
      0
      • G Gareth H

        MrColeyted, Listen for the ListView.SelectedIndexChanged event. http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.onselectedindexchanged.aspx[^] Then do TreeView.Nodes.Add(WhatYouWantToAdd); http://msdn2.microsoft.com/en-us/library/system.windows.forms.treeview.aspx[^] Regards, Gareth.

        M Offline
        M Offline
        MrColeyted
        wrote on last edited by
        #3

        Thanks for the feedback, but I have researched these things and I don't see how to do what I need, which is not add a node, but rather redraw the treeview to repopulate an existing node. For example: if I click the program files directory in the treeview, the directory is expanded in the treeview to show all of the folders; all of the folders and files are displayed in the listview. What I need to do is this: by clicking on a folder in the listview, lets say the Adobe folder, I want the Adobe folder in the treeview to be expanded to show all of the folders one level under the Adobe folder. Of course this should work for as many clicks in the listview as the user performs. Any suggestions?:confused:

        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