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...
Printable View
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...
Hi,
Try this:
Hope this helpsCode: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
Shaun