How do I add a child in the middle of a node?

Posted on 2007-10-19
Last Modified: 2013-11-25
I am writing a track meet/statistics program in VB 6.  The following is the code I'm using.
    Dim fir As String, second As String, itself As String
    If Not tvw.DropHighlight Is Nothing Then
        If Left(tvw.SelectedItem, 1) = Left(tvw.DropHighlight.Text, 1) Then
            Select Case Len(tvw.DropHighlight)
                Case 1
                    tvw.DropHighlight.Text = Left(tvw.DropHighlight.Text, 1) & Right(tvw.SelectedItem, Len(tvw.SelectedItem) - 1)
                    tvw.SelectedItem = Left(tvw.SelectedItem, 1)
                Case Else
                    Set mNode = tvw.Nodes.add(tvw.DropHighlight, , , Left(tvw.DropHighlight.Text, 1) & Right(tvw.SelectedItem.Text, Len(tvw.SelectedItem.Text) - 1))
                    tvw.SelectedItem = Left(tvw.SelectedItem, 1)
            End Select
        End If
        For i = 1 To tvw.Nodes.Count
            If Len(tvw.Nodes.Item(i)) = 1 Then
                If Left(tvw.Nodes.Item(i).Text, 1) = Left(tvw.Nodes.Item(tvw.Nodes.Count).Text, 1) Then
                    If i = tvw.Nodes.Count Then
                        tvw.Nodes.Remove tvw.SelectedItem.Index
                        Exit For
                    End If
                End If
            End If
        Next i
        Set tvw.DropHighlight = Nothing
        Set mNode = Nothing
    End If
When it adds the dragged athlete it drops in the correct spot but it adds it and makes it the last node in the list.  How do I make it the node number where I dropped it?
Question by:scottsee
    LVL 44

    Accepted Solution

    You should be able to use the  .HitTest method that will tell your program what node is below the mouse.
    LVL 44

    Expert Comment

    You should be able to use the  .HitTest method that will tell your program what node is below the mouse.
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now