CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Jun 2011

    Moving/Swapping values in a TREEVIEW

    I appologize if this is a duplicate, but I could not find my first post.
    Hello All:
    I just realized this section of the forum is available.

    I have a problem with some existing source code. I think I can tell you the lines that need to be modified, I just don't understand this enough to be able to make the change.

    Some fine folks here have helped me get this far, but I just can't get over this hump.

    I have attached the current project and associated source code, along with printscreens.

    Here is a summary of the problem.
    1)Run the project
    2)Select 'Load Tree'
    3)Select 'Sort'
    4)Look at Tv1 this is where the information is sorted and redisplayed.
    5)Everything NODE ending with an "*" should be sorted to the bottom of the tree, ALONG WITH everything under it.

    This is where my problem comes in. The second level is sorted to the end, but not the values underneath it.

    It is my understanding that when a node is moved/swapped everything under it will go with it. That is children stay with their parent. If it were working that way, my problem would be solved. However this code is moving the parent and leaving the children behind.

    I believe the problem is in the SortChild Sub and in the following lines, but I can't be sure

                    Set chTemp = ch1(intI)
                    Set ch1(intI) = ch1(intRnd)
                    Set ch1(intRnd) = chTemp
    Name:  BEFORE.png
Views: 99
Size:  12.7 KB

    Name:  AFTER.png
Views: 95
Size:  13.8 KB

    Should be:
    Name:  should.png
Views: 101
Size:  17.3 KB
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.