Results 1 to 5 of 5

Thread: finding all parent nodes in a treeview

  1. #1
    zubair
    Guest

    finding all parent nodes in a treeview

    I am trying to find all the parent nodes.
    I have been trying the following with the parent property, but it says that it is nothing, any suggestions????

    for intIndex = 1 To Journey_Tree1.Nodes.Count
    Set nodTmp = Journey_Tree1.Nodes.Item(ind)
    If nodTmp.Parent Then
    strTmpKey = Journey_Tree1.Nodes(ind).key
    end if
    next

  2. #2
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179
    try using "If nodTmp.Parent Is Nothing Then"
    instead of "If nodTmp.Parent Then "

    hth.

  3. #3
    Junior Member
    Join Date
    Aug 2000
    Location
    DAKAR (Sénégal)
    Posts
    26
    you can try also

    for i = 1 to mytreeview.nodes.count

    if mytreeview.nodes(i).children > 0 then
    msgbox "this is a parent node"
    end if

    next
    Thoms

  4. #4
    zubair
    Guest
    thanks for that but i get an Invalid use of object when i put NOT.

    For ind = 1 To Journey_Tree1.Nodes.Count
    Set nodTmp = Journey_Tree1.Nodes.Item(ind)
    If nodTmp.Parent Is Not Nothing Then

    any other suggestions???

  5. #5
    nullus
    Guest
    i just made this mistake in the thread below

    VB Code:
    1. If Not (nodTmp.Parent Is Nothing) Then

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