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. Is this possible?

Is this possible?

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

    I’ve got a treeview control on a windows form and the treeview is already populated. Is their a way to traverse through the tree looking for a node with certain text, then remove that node when the matched node with the text is found? I’m passing in the string text of the node I want to delete from another form, the tree is located on the parent form. The tree looks like this. I want to delete Smith when it's passed in from the other form. Employee Johnson Smith Employee Location Boston Seattle If this is possible any help would be greatly appreciated. The code below won’t work since I don’t want to select the node manually. TreeNode tn = treeView1.SelectedNode; treeView1.Nodes.Remove(tn); :-D

    N 1 Reply Last reply
    0
    • M Manster

      I’ve got a treeview control on a windows form and the treeview is already populated. Is their a way to traverse through the tree looking for a node with certain text, then remove that node when the matched node with the text is found? I’m passing in the string text of the node I want to delete from another form, the tree is located on the parent form. The tree looks like this. I want to delete Smith when it's passed in from the other form. Employee Johnson Smith Employee Location Boston Seattle If this is possible any help would be greatly appreciated. The code below won’t work since I don’t want to select the node manually. TreeNode tn = treeView1.SelectedNode; treeView1.Nodes.Remove(tn); :-D

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      Just use a for loop to traverse the tree, inside the for loop check the text value of the node. -Nick Parker

      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