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. How to refresh Treeview control

How to refresh Treeview control

Scheduled Pinned Locked Moved C#
designtutorial
9 Posts 5 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.
  • G Offline
    G Offline
    Gonxh Aniket
    wrote on last edited by
    #1

    Hi, In my treeview control, I changed the indexes of the nodes. While debugging, I found indexes of the nodes are changed successfully. But the changes were not reflecting in the UI. Please let me know how to refresh the treeview. Thanks in advance..

    M X P 3 Replies Last reply
    0
    • G Gonxh Aniket

      Hi, In my treeview control, I changed the indexes of the nodes. While debugging, I found indexes of the nodes are changed successfully. But the changes were not reflecting in the UI. Please let me know how to refresh the treeview. Thanks in advance..

      M Offline
      M Offline
      musefan
      wrote on last edited by
      #2

      have you tried: treeview.Refresh(); or treview.Invalidate();

      My opinion is... If someone has already posted an answer, dont post the SAME answer

      G 1 Reply Last reply
      0
      • M musefan

        have you tried: treeview.Refresh(); or treview.Invalidate();

        My opinion is... If someone has already posted an answer, dont post the SAME answer

        G Offline
        G Offline
        Gonxh Aniket
        wrote on last edited by
        #3

        ya, I tried both. They are not working.. I tried treeview.Update(), but in vain..

        M 1 Reply Last reply
        0
        • G Gonxh Aniket

          ya, I tried both. They are not working.. I tried treeview.Update(), but in vain..

          M Offline
          M Offline
          musefan
          wrote on last edited by
          #4

          are the nodes you change at the same level in the tree view. I have not tried changing the index before i can only think that maybe the index does not represent what you think it means? or maybe is there anything set that auto sorts the nodes? like aplhabetically or something?

          My opinion is... If someone has already posted an answer, dont post the SAME answer

          1 Reply Last reply
          0
          • G Gonxh Aniket

            Hi, In my treeview control, I changed the indexes of the nodes. While debugging, I found indexes of the nodes are changed successfully. But the changes were not reflecting in the UI. Please let me know how to refresh the treeview. Thanks in advance..

            X Offline
            X Offline
            Xmen Real
            wrote on last edited by
            #5

            AFAIK you cant change index of any node, its readonly property(Index). It would be better if you explain how did you change the indexes...

            TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

            M G 2 Replies Last reply
            0
            • X Xmen Real

              AFAIK you cant change index of any node, its readonly property(Index). It would be better if you explain how did you change the indexes...

              TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

              M Offline
              M Offline
              MadArtSoft
              wrote on last edited by
              #6

              Load again Tree.

              C# controls, .Net components. Help Desk Software

              1 Reply Last reply
              0
              • G Gonxh Aniket

                Hi, In my treeview control, I changed the indexes of the nodes. While debugging, I found indexes of the nodes are changed successfully. But the changes were not reflecting in the UI. Please let me know how to refresh the treeview. Thanks in advance..

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                Are you using Remove and Insert to move the node? (I've never tried it, but suppose it should work.)

                G 1 Reply Last reply
                0
                • X Xmen Real

                  AFAIK you cant change index of any node, its readonly property(Index). It would be better if you explain how did you change the indexes...

                  TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can

                  G Offline
                  G Offline
                  Gonxh Aniket
                  wrote on last edited by
                  #8

                  I used the following code to change the indexes. TreeNode Node0 = treeView2.Nodes[i - 1]; TreeNode Node1 = treeView2.Nodes[i]; foreach (TreeNode node in treeView1.Nodes[0].Nodes) { if (Node1.Text == node.Text) { m = node.Index; } if (Node0.Text == node.Text) { n = node.Index; } } if (m < n) { tempNode = Node1; Node1 = Node0; Node0 = tempNode; }

                  1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    Are you using Remove and Insert to move the node? (I've never tried it, but suppose it should work.)

                    G Offline
                    G Offline
                    Gonxh Aniket
                    wrote on last edited by
                    #9

                    no, please look at the code which I posted now.

                    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