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. Select a treeNode in a treeView

Select a treeNode in a treeView

Scheduled Pinned Locked Moved C#
question
5 Posts 2 Posters 1 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.
  • K Offline
    K Offline
    Kim0618
    wrote on last edited by
    #1

    Hi, Is it possible to select and expand a treeNode in a treeView by program, with the treeNode highlighted ? I tried many methods, but none can get the treeNode highlighted while it expand ! I want to emulate the situation where user click the treeNode by program. Thanks Kim

    L 1 Reply Last reply
    0
    • K Kim0618

      Hi, Is it possible to select and expand a treeNode in a treeView by program, with the treeNode highlighted ? I tried many methods, but none can get the treeNode highlighted while it expand ! I want to emulate the situation where user click the treeNode by program. Thanks Kim

      L Offline
      L Offline
      Laji59
      wrote on last edited by
      #2

      You can do it by using SelecedNode. example : TreeView1.SelecedNode = TreeView1.Nodes[0].Nodes[4].Nodes[20]; TreeView1.Focus();

      Hello Friends

      K 1 Reply Last reply
      0
      • L Laji59

        You can do it by using SelecedNode. example : TreeView1.SelecedNode = TreeView1.Nodes[0].Nodes[4].Nodes[20]; TreeView1.Focus();

        Hello Friends

        K Offline
        K Offline
        Kim0618
        wrote on last edited by
        #3

        It works ! Thanks so much

        L 1 Reply Last reply
        0
        • K Kim0618

          It works ! Thanks so much

          L Offline
          L Offline
          Laji59
          wrote on last edited by
          #4

          You`re welcome

          Hello Friends

          K 1 Reply Last reply
          0
          • L Laji59

            You`re welcome

            Hello Friends

            K Offline
            K Offline
            Kim0618
            wrote on last edited by
            #5

            Hi, I just find a problem in getting the treeNode selected and highlighted if the treeView is in a panel rather than in the form directly, the treeNode cannot get the focus. I try to focus the panel also, but it didnt help. Thanks

            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