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. treeview question c# win form

treeview question c# win form

Scheduled Pinned Locked Moved C#
csharpquestion
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.
  • F Offline
    F Offline
    fady_sayegh
    wrote on last edited by
    #1

    hi to all, i have a treeview with some nodes with checkboxes when the user check or uncheck a parent node, i want to check or uncheck all the child nodes (child nodes are maybe checked or unchecked) can someone post some code sample best regards and thanks in advance fady

    M 1 Reply Last reply
    0
    • F fady_sayegh

      hi to all, i have a treeview with some nodes with checkboxes when the user check or uncheck a parent node, i want to check or uncheck all the child nodes (child nodes are maybe checked or unchecked) can someone post some code sample best regards and thanks in advance fady

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Hi! You can solve this task by using a simple recursive function:

      void CheckChildNodes(TreeNode parent, bool checked)
      {
      parent.Checked = checked;
      foreach (TreeNode nd in parent.Nodes)
      CheckChildNodes(nd, checked);
      }

      Regards, mav

      F 1 Reply Last reply
      0
      • M mav northwind

        Hi! You can solve this task by using a simple recursive function:

        void CheckChildNodes(TreeNode parent, bool checked)
        {
        parent.Checked = checked;
        foreach (TreeNode nd in parent.Nodes)
        CheckChildNodes(nd, checked);
        }

        Regards, mav

        F Offline
        F Offline
        fady_sayegh
        wrote on last edited by
        #3

        thanks a lot mav fady

        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