Results 1 to 2 of 2

Thread: Question about tree view

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Tucson, AZ, USA
    Posts
    95
    I have a treeview with several parent and child views, but only those two layers. I want to grab the text from the Parent when I click on the child, is there a way to do this.

    In otherwords if I have this:

    Fred
    |
    |----Address
    |----Phone Number

    And i click on address, I want to set a string variable to the Text of the parent, in this case Fred. Thanks in advance

    Ed Farias

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    Here you go:

    Code:
    Private Sub myTree_NodeClick(ByVal Node As MSComctlLib.Node)
    Dim myText
    If Node.Children > 0 Then Exit Sub
    myText = Node.Parent.Text
    MsgBox myText
    End Sub
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

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