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

Posted on 2007-10-19
Medium Priority
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
  • 2
LVL 46

Accepted Solution

aikimark earned 500 total points
ID: 20113267
You should be able to use the  .HitTest method that will tell your program what node is below the mouse.

LVL 46

Expert Comment

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


Expert Comment

ID: 20305316
Forced accept.

EE Admin

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

807 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