Treeview and ListBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veenna
    New Member
    • Dec 2007
    • 65

    Treeview and ListBox

    hi,

    I have to display some data in TreeView Control and the Treeview control should be inside a LIst box.


    Is It Possible to use TreeView inside a list box OR can i list details in list box in tree view format?


    regards
    veena
  • joedeene
    Contributor
    • Jul 2008
    • 579

    #2
    well one significant feature between listbox items and treeview nodes, are that the listbox items consist of only strings and have no children items to collapse and expand. so it would be kind of pointless to show a listbox's items in a treeview node, since it has no children. but a simple code is to use the For Each method to check each string in the listbox items and turn them into a treenode, which can then be added to the treeview class.

    Code:
    Private Sub test_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                 For Each item As String In ListBox1.Items
                Dim mynewnode As New TreeNode(item)
                TreeView1.Nodes.Add(mynewnode)
            Next
        End Sub
    please reply if thats not what you wanted, because i couldnt quite understand what you were looking for

    Comment

    • veenna
      New Member
      • Dec 2007
      • 65

      #3
      hi joedeene,


      thank u for the replay..

      i am working in .net2003 and i downloaded microsofts treeview control. it is working in mozilla but not in IE . how can i work with treeview in .net2003. any idea?


      regards
      veena

      Comment

      • joedeene
        Contributor
        • Jul 2008
        • 579

        #4
        sorry, i cant help you, i have no experience with .net 2003, and it sounds like you're doing some kinda online application and i dont have experience with asp.net and such. sorry...

        Comment

        Working...