|
-
Sep 30th, 2000, 02:50 PM
#1
Thread Starter
Junior Member
Hi...I am working with the treeview ctrl... When I right click to its nodes, I want to be able to determine what type of node is selected... the root, a 1st level child, a 2nd level child ?? etc...
Any ideas?
Thank you...
-
Sep 30th, 2000, 03:39 PM
#2
Addicted Member
Hi,
Try this:
Code:
Private Sub TreeView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
'This will work as long as none your node
'names contains the character "\"
If Button = 2 Then 'Show on right mouse click
Dim i As Integer
Dim TV As String
Dim Count As Integer
TV = TreeView1.SelectedItem.FullPath
For i = 1 To Len(TV)
If Mid(TV, i, 1) = "\" Then Count = Count + 1
Next i
If Count = 0 Then
MsgBox "This is a top-level node"
Else
MsgBox "This node is " & CStr(Count) & " levels into the structure"
End If
End If
End Sub
Hope this helps
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
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
|