Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expand tree control

Status
Not open for further replies.

tmpalaniselvam

Programmer
May 14, 2000
68
IN
Hi!
I want to expand one of the nodes in the tree. Other nodes which are not in the part of that node will be closed. How to do it? Any other have samples??
Thanks and Regards,
Palani.
mail to: tmpalaniselvam@yahoo.com
 
to get you started...

Code:
Option Explicit

Private Sub Form_Load()
  Dim nodX As Node
  
  With TreeView1.Nodes
    Set nodX = .Add(, , "Root", "Root")
    Set nodX = .Add("Root", tvwChild, "Child1", "Child1")
    Set nodX = .Add("Root", tvwChild, "Child2", "Child2")
    Set nodX = .Add("Root", tvwChild, "Child3", "Child3")
    Set nodX = .Add("Child1", tvwChild, "GrandChild11", "GrandChild11")
    Set nodX = .Add("Child1", tvwChild, "GrandChild12", "GrandChild12")
    Set nodX = .Add("Child1", tvwChild, "GrandChild13", "GrandChild13")
    Set nodX = .Add("Child2", tvwChild, "GrandChild21", "GrandChild21")
    Set nodX = .Add("Child2", tvwChild, "GrandChild22", "GrandChild22")
    Set nodX = .Add("Child2", tvwChild, "GrandChild23", "GrandChild23")
    Set nodX = .Add("Child3", tvwChild, "GrandChild31", "GrandChild31")
    Set nodX = .Add("Child3", tvwChild, "GrandChild32", "GrandChild32")
    Set nodX = .Add("Child3", tvwChild, "GrandChild33", "GrandChild33")
  
 End With
End Sub

Private Sub Form_Resize()
  TreeView1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub

Private Sub mnuCollapse_Click()
  Dim nodX As Node
  
  For Each nodX In TreeView1.Nodes
    nodX.Expanded = False
  Next nodX
End Sub

Private Sub mnuExpand2_Click()
  mnuCollapse_Click
  
  With TreeView1.Nodes("Child2")
    .EnsureVisible
    .Expanded = True
  End With
End Sub
 
Hi!
Many thnaks. I gave in Node's expand and collapse events. But no improvement. I try this in SP4 common tree view control. Thanks and Regards,
Palani.
mail to: tmpalaniselvam@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top