Results 1 to 2 of 2

Thread: Tree View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    93

    Question

    I am using tree view to display hierarchical data. I am using the tree view style 7 that displays text, plus minus, and a picture.

    My problem is that plus and minus only displays if the node contain a child node but only after you actually populate the node.

    What I have done up to now is to perform a function "CheckForChild" for each node as it populates which checks to see if there are any futher children and then sets the display of the picture icon to show that there are children.
    What I want to do is to display the 'plus' sign instead.

    The only way I seem to be able to do this is to pouplate the entire tree and then collapse it however I only want to populate each level as it is displayed as it is a database recordset and the levels can run very deep and I don't want to load up the entire recordset.

    Any thoughts...Any one...??

  2. #2
    Member
    Join Date
    Sep 2000
    Posts
    34
    Set the image/+, - properties of the file treeview, then populate it like this:

    Dim iFileNum As Integer
    Dim strParentName As String
    Dim strChildName As String

    tvwMain.Nodes.Clear
    dlgFileOpenClose.CancelError = True

    strFileName = "\nameofdatafile.txt"
    iFileNum = FreeFile
    Open strFileName For Input As #iFileNum

    Input #iFileNum, strChildName, strParentName

    Call AddRootNode(strChildName)

    While Not EOF(iFileNum)

    Input #iFileNum, strChildName, strParentName
    Call AddNode(strChildName, strParentName)
    Wend


    Close #iFileNum

    ' The following line expands the first branch
    tvwMain.Nodes(1).Expanded = True

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