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. .NET (Core and Framework)
  4. Treeview iteration

Treeview iteration

Scheduled Pinned Locked Moved .NET (Core and Framework)
designdata-structureshelpannouncement
1 Posts 1 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.
  • U Offline
    U Offline
    User 9285131
    wrote on last edited by
    #1

    I have a tree created at design time with 3 root nodes and 3 levels 3x3x3 =39 nodes as the default. The nodes can be dynamically recreated. When I cleared the nodes then recreated them, I tried looping through to add properties to the nodes of each level including their relevant context menu name.

    Private Sub RedoTree\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RedoTree.Click
    
    	treeLoad()
    	treeExecutive.ExpandAll()
    	restoreTP()
    	treeExecutive.Nodes(0).EnsureVisible()
    
    End Sub
    
    Sub restoreTP() '				renew treenode properties
    
    	Dim s As String, l As Short
    
    	treeExecutive.Update()
    
    	For Each treenode In treeExecutive.Nodes
    		s = treenode.Name
    		l = Len(s)
    		treenode.ForeColor = Color.GhostWhite
    
    		If treenode.Text <> s Then treenode.ForeColor = Color.Black
    
    		Select Case l
    			Case 1
    				treenode.NodeFont = New Font("Arial Rounded MT Bold", 10.8)
    				treenode.ContextMenuStrip = CMSRoot
    			Case 2
    				treenode.NodeFont = New Font("Arial", 10.2)
    				treenode.ContextMenuStrip = CMSTree
    			Case Else
    				treenode.NodeFont = New Font("Arial Narrow", 9)
    				treenode.ContextMenuStrip = CMSTree
    		End Select
    
    	Next
    
    End Sub
    

    The root nodes are number 1-3, then 11,12,13 .... 111,112,113 Total is 39 nodes

    ONLY THE ROOT NODES ARE RECOGNISED AND DEALT WITH.

    All the child nodes are ignored as if they don't exist

    Am bogged down on this and would appreciate any help :confused:

    demac

    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