|
-
Sep 11th, 2001, 08:28 AM
#1
Thread Starter
New Member
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
-
Sep 11th, 2001, 01:15 PM
#2
Lively Member
Plain logic :
1. Create a new node at the desired position.
2. Delete the old one.
-
Sep 11th, 2001, 11:42 PM
#3
Thread Starter
New Member
Plain Logic
Thinktank.
Try Inserting a new node and then push the tree up.Your Plain Logic goes for a toss
-
Sep 11th, 2001, 11:43 PM
#4
PowerPoster
It should be in some kind of vb forum
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|