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. Event: Treeview-AfterSelect

Event: Treeview-AfterSelect

Scheduled Pinned Locked Moved Visual Basic
csharpdata-structureshelp
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.
  • W Offline
    W Offline
    watagal
    wrote on last edited by
    #1

    Greetings! I'm having trouble with my treeview. Once I select a node from the treeview, it invokes the AfterSelect event, re-fills my nodes and the re-executes the AfterSelect event (again) - thus re-filling my node tree: Private Sub uxGpDirectoryTree_AfterSelect( _ ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) _ Handles uxGpDirectoryTree.AfterSelect Me.StartDir += uxGpDirectoryTree.SelectedNode.Text + "\" call fillDirectoryTree() End Sub Private Sub fillDirectoryTree() Dim arrSubfolders() As DirectoryInfo arrSubfolders = New DirectoryInfo(Me.StartDir).GetDirectories uxGpDirectoryTree.Nodes.Clear() For Each subfolder As DirectoryInfo In arrSubfolders uxGpDirectoryTree.Nodes.Add(subfolder.Name) Next End SubI have debugged and it does cycle more than once. Any help would be greatly appreciated. Thanks, Karen Nooobie to OOP and VB.Net 2005

    W D 2 Replies Last reply
    0
    • W watagal

      Greetings! I'm having trouble with my treeview. Once I select a node from the treeview, it invokes the AfterSelect event, re-fills my nodes and the re-executes the AfterSelect event (again) - thus re-filling my node tree: Private Sub uxGpDirectoryTree_AfterSelect( _ ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) _ Handles uxGpDirectoryTree.AfterSelect Me.StartDir += uxGpDirectoryTree.SelectedNode.Text + "\" call fillDirectoryTree() End Sub Private Sub fillDirectoryTree() Dim arrSubfolders() As DirectoryInfo arrSubfolders = New DirectoryInfo(Me.StartDir).GetDirectories uxGpDirectoryTree.Nodes.Clear() For Each subfolder As DirectoryInfo In arrSubfolders uxGpDirectoryTree.Nodes.Add(subfolder.Name) Next End SubI have debugged and it does cycle more than once. Any help would be greatly appreciated. Thanks, Karen Nooobie to OOP and VB.Net 2005

      W Offline
      W Offline
      watagal
      wrote on last edited by
      #2

      Not exactly what I wanted, but DoubleClick seams to work. Thanks, Karen Nooobie to OOP and VB.Net 2005

      1 Reply Last reply
      0
      • W watagal

        Greetings! I'm having trouble with my treeview. Once I select a node from the treeview, it invokes the AfterSelect event, re-fills my nodes and the re-executes the AfterSelect event (again) - thus re-filling my node tree: Private Sub uxGpDirectoryTree_AfterSelect( _ ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) _ Handles uxGpDirectoryTree.AfterSelect Me.StartDir += uxGpDirectoryTree.SelectedNode.Text + "\" call fillDirectoryTree() End Sub Private Sub fillDirectoryTree() Dim arrSubfolders() As DirectoryInfo arrSubfolders = New DirectoryInfo(Me.StartDir).GetDirectories uxGpDirectoryTree.Nodes.Clear() For Each subfolder As DirectoryInfo In arrSubfolders uxGpDirectoryTree.Nodes.Add(subfolder.Name) Next End SubI have debugged and it does cycle more than once. Any help would be greatly appreciated. Thanks, Karen Nooobie to OOP and VB.Net 2005

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

        It looks like you're wiping out your entire TreeView, then refilling it with the subdirectories under the node that was selected. Is this really what you want? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        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