-
Aug 21st, 2015, 09:50 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] need help:treeview selecting nodes
Selecting treeview nodes
Tree Example:
Root
>--- IBANEZ (Parent Node)
|------ Gio (Child Node)
|------ RG
|------ JEM
|------ PGM
>--- BOSS (Parent Node)
|------ Metal Zone
|------ Noise Gate
>--- Yamaha (Parent Node)
For example I select : Yamaha
Message box will appear "Parent Node"
example I select : Noise Gate
Message box will appear "Child Node"
Any Idea? Thanks in advance
-
Aug 21st, 2015, 10:08 AM
#2
Thread Starter
Hyperactive Member
Re: need help:treeview selecting nodes
Please check out what went wrong.
Code:
Dim objNode As node
Set objNode = .SelectedItem
If Not objNode Is Nothing Then
If objNode.Children > 0 Then
MsgBox "Parent Node"
' I'm having a problem here
' What if it doesn't have a child?
' It become a child.... How do I handle this part?
' It must be the parent.
Else
MsgBox "Child Node"
End If
Set objNode = Nothing
End If
-
Aug 21st, 2015, 10:43 AM
#3
Thread Starter
Hyperactive Member
Re: need help:treeview selecting nodes
I get it... Problem solved
Code:
If Not node.Parent Is Nothing Then
If Not node.Parent.Parent Is Nothing Then
MsgBox "Child"
Else
MsgBox "Parent"
End If
Else
MsgBox "Root"
End If
-
Aug 21st, 2015, 01:03 PM
#4
Re: [RESOLVED] need help:treeview selecting nodes
Alternate method:
Code:
If Not Node Is Node.Root Then
If Not Node.FirstSibling Is Node.Root.Child Then
MsgBox "Child Node", vbInformation
Else
MsgBox "Parent Node", vbInformation
End If
Else
MsgBox "Root Node", vbInformation
End If
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
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
|