Results 1 to 5 of 5

Thread: TreeView Control

  1. #1

    Thread Starter
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    TreeView Control

    Can anyone provide a decent guide/tutorial on using the Microsoft TreeView control? I need to use it in my project to present a better layout in which the user can access certain elements, but I found the best way would be to display it in a hiarchy type way, or in other words a TreeView. I searched google, didn't come up with much only got a few on using them in .NET. Thanks
    Age - 15 ::: Level - Advanced
    If you find my post useful please ::Rate It::


  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    Re: TreeView Control

    I have attached a folder containing a set of examples which you should find useful. There is also a doc in there explaining what the examples are, with screen shots. While this is a not a "tutorial" per se, you should be able to study the sample apps (particularly the first and second) to get a good idea of how to use the TreeView. Let me know how you make out.
    Attached Files Attached Files
    "It's cold gin time again ..."

    Check out my website here.

  3. #3
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    Re: TreeView Control

    Quote Originally Posted by Inuyasha1782
    Can anyone provide a decent guide/tutorial on using the Microsoft TreeView control? I need to use it in my project to present a better layout in which the user can access certain elements, but I found the best way would be to display it in a hiarchy type way, or in other words a TreeView. I searched google, didn't come up with much only got a few on using them in .NET. Thanks
    I hope following link will clear your doubts :

    http://www.vbforums.com/showthread.php?t=387696
    On Error GoTo http://www.vbforums.com

    Note :
    1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
    2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.

  4. #4

    Thread Starter
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: TreeView Control

    This is off topic a little, but I might as well spare a new thread. Here is my current code:

    VB Code:
    1. Dim testname As String
    2. Dim TestData() As String
    3.  
    4. Private Sub Command1_Click()
    5.     Dim Key As String
    6.  
    7.     Key = InputBox("Please define a key for this element:", "Define Key")
    8.     lsttest.Nodes.Add "root", tvwChild, "element" & lsttest.Nodes.Count, "sub" & Key
    9.     lsttest.Nodes.Item(1).Expanded = True
    10.     ReDim Preserve TestData(lsttest.Nodes.Item(1).Children, 0)
    11.     TestData(lsttest.Nodes.Item(1).Children, 0) = "Enter question here"
    12. End Sub
    13.  
    14. Private Sub Command2_Click()
    15.     MsgBox lsttest.Nodes.Item(1).Children
    16. End Sub
    17.  
    18. Private Sub Form_Load()
    19.  
    20.     testname = "Test1"
    21.     ReDim TestData(0, 0)
    22.     lsttest.Nodes.Add , , "root", testname
    23.  
    24. End Sub

    I get a subscript out of range error on:

    VB Code:
    1. ReDim Preserve TestData(lsttest.Nodes.Item(1).Children, 0)

    I remember having this error before but forgot how to resolve it. I debugged and at the time of the error, "lsttest.Nodes.Item(1).Children", was equal to 1. Any idea?
    Age - 15 ::: Level - Advanced
    If you find my post useful please ::Rate It::


  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

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