Results 1 to 8 of 8

Thread: create a tree view[resolved]

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    41

    Resolved create a tree view[resolved]

    Actually this is how i want

    Zones
    -Zone1
    --- Room1
    -- Room2
    -Zone2
    -- Room1
    --Room2

    Thanks
    Sai Abhiram Bandhakavi
    Last edited by sai_abhiram; Feb 18th, 2006 at 03:22 AM. Reason: Resolved

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: create a tree view

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     TreeView1.LineStyle = tvwRootLines
    5.     TreeView1.Sorted = False
    6.     TreeView1.Style = tvwTreelinesPlusMinusText
    7.     TreeView1.Nodes.Add , , "Main", "Zones"
    8.     TreeView1.Nodes.Add "Main", tvwChild, "Zone1", "Zone1"
    9.     TreeView1.Nodes.Add "Zone1", tvwChild, "Z1Room1", "Room1"
    10.     TreeView1.Nodes.Add "Zone1", tvwChild, "Z1Room2", "Room2"
    11.     TreeView1.Nodes.Add "Main", tvwChild, "Zone2", "Zone2"
    12.     TreeView1.Nodes.Add "Zone2", tvwChild, "Z2Room1", "Room1"
    13.     TreeView1.Nodes.Add "Zone2", tvwChild, "Z2Room2", "Room2"
    14. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    41

    Thumbs up Re: create a tree view[resolved]

    thanks man , its workin really the way i wanted it to be.

  4. #4
    Member
    Join Date
    Jan 2006
    Posts
    62

    Re: create a tree view[resolved]

    i want to show the result as shown below. i want to access the data from database instead of hardcoding.

    LocationName
    -----------------SuiteName1
    ----------------------------------Floor1
    -------------------------------------------Room 101
    -------------------------------------------Room 102
    -------------------------------------------Room 10n
    ----------------------------------Floor2
    -------------------------------------------Room 201
    -------------------------------------------Room 202
    -------------------------------------------Room 20n
    ----------------------------------Floorn
    -------------------------------------------Room 101
    -------------------------------------------Room 102
    -------------------------------------------Room 10n

    -----------------SuiteName2
    ----------------------------------Floor1
    ----------------------------------Floor2
    ----------------------------------Floor3
    ----------------------------------Floorn
    -----------------SuiteNamen
    ----------------------------------Floor1
    ----------------------------------Floor2
    ----------------------------------Floor3
    ----------------------------------Floorn

    hope u understood. Pl help me

    Regards
    Hiran

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

    Re: create a tree view[resolved]

    hiran3727:
    Check out my response (#2 of this thread) :
    http://www.vbforums.com/showthread.php?t=387898
    I posted an attachment that contains several Treeview examples which you may find helpful.
    "It's cold gin time again ..."

    Check out my website here.

  6. #6
    Member
    Join Date
    Jan 2006
    Posts
    62

    Re: create a tree view[resolved]

    hi,
    i have vb6 in my system. I am not finding MS common controls 6.0 to get the tree view component. pl suggest

    hiran

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: create a tree view[resolved]

    Project > Components > Controls tab > select "Windows Common Controls 6.0" click OK.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8
    Member
    Join Date
    Jan 2006
    Posts
    62

    Re: create a tree view[resolved]

    hi,
    i have used the code which was mentioned in #2. Its working fine. But according to my requirement it is different.
    Ex:
    Location
    Suite
    Floor
    Room

    Under one Location, there will be n number of Suites and under one Suite there will n number of Floor and under one floor there will be n number of rooms.

    Once i select Location from the combo box, i want to display its suites, floors and rooms under each child node.

    Pl help

    regards
    Hiran

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