Results 1 to 4 of 4

Thread: TreeView Up

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2001
    Location
    India
    Posts
    2

    Exclamation TreeView Up

    Hi

    I had posted a help asking how to Move an Node in a Tree Up and down.It is really unfortunate that none of them came up with the code.

    Here is the code which does the Following.

    On a treeview control it rearranges the node when the button move up is pressed.

    Private Sub mnuMU_Click()
    Dim sFirstSib As String, sClickedText As String, sPrevText As String
    Dim sParentKey As String,sCurKey as string,sPrevkey as string
    Dim iPAFno As Integer, iCAFno As Integer


    'STORE THE FIRST SIBLING OF THE CURRENTLY CLICKED ROOT NODE
    sFirstSib = treSummary.Nodes(sKey).FirstSibling

    'IF THE TEXT OF THE CLICKED NODE IS EQUAL TO THE FIRSTSIBLING THEN U CANNOT MOVE THE ITEM UP.
    If (treSummary.Nodes(sKey).Text) = sFirstSib Then
    MsgBox "Cannot Move Up", vbInformation, Title
    Else
    sPrevKey = treSummary.Nodes(frmInsertTree.sKey).Previous.Key
    sCurKey = treSummary.Nodes(sKey).Key
    sParentKey = treSummary.Nodes(sKey).Parent.Key
    sClickedText = treSummary.Nodes(sKey).Text
    sPrevText = treSummary.Nodes(sKey).Previous


    treSummary.Nodes(sPrevKey).Text = sClickedText
    treSummary.Nodes(sCurKey).Text = sPrevText




    End If
    End Sub

    Private Sub treSummary_NodeClick(ByVal Node As MSComctlLib.Node)

    skey=node.key

    End sub
    Thanks
    Sajiv K

  2. #2
    Lively Member
    Join Date
    Jun 2001
    Location
    Banana Republic
    Posts
    115
    Plain logic :

    1. Create a new node at the desired position.
    2. Delete the old one.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2001
    Location
    India
    Posts
    2

    Plain Logic

    Thinktank.
    Try Inserting a new node and then push the tree up.Your Plain Logic goes for a toss
    Thanks
    Sajiv K

  4. #4
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    It should be in some kind of vb forum
    Baaaaaaaaah

Posting Permissions

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



Click Here to Expand Forum to Full Width