|
-
Feb 18th, 2006, 04:04 AM
#1
Thread Starter
Member
How to Expand a tree at Run time
Hi,
Here i have a tree view at run time tha works well. On loading the form it shows the tree in the collapsed mode showing only the root. when i load the form i want the form to be completely expanded at all levels.
How can i do this.
Thanks,
Sai Abhiram Bandhakavi
-
Feb 18th, 2006, 04:09 AM
#2
Re: How to Expand a tree at Run time
VB Code:
Option Explicit
Private Sub Form_Load()
Dim i As Integer
TreeView1.LineStyle = tvwRootLines
TreeView1.Sorted = False
TreeView1.Style = tvwTreelinesPlusMinusText
TreeView1.Nodes.Add , , "Main", "Zones"
TreeView1.Nodes.Add "Main", tvwChild, "Zone1", "Zone1"
TreeView1.Nodes.Add "Zone1", tvwChild, "Z1Room1", "Room1"
TreeView1.Nodes.Add "Zone1", tvwChild, "Z1Room2", "Room2"
TreeView1.Nodes.Add "Main", tvwChild, "Zone2", "Zone2"
TreeView1.Nodes.Add "Zone2", tvwChild, "Z2Room1", "Room1"
TreeView1.Nodes.Add "Zone2", tvwChild, "Z2Room2", "Room2"
'Expand the tv:
For i = 1 To TreeView1.Nodes.Count
TreeView1.Nodes.Item(i).Expanded = True
Next
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Feb 18th, 2006, 04:33 AM
#3
Thread Starter
Member
[Resolved] How to Expand a tree at Run time
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|