PDA

View Full Version : Sleeper: Treeview selection problem



gibbo1715
09-20-2005, 02:37 PM
i have a list box and when i click on an item within it i want it to select an item from a treeview on a different userform (Userform1), i am using the code as follows


Dim StrParent As String
Dim StrChild As String
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
StrParent = ListBox1.List(i, 5) ' Contains the name of the parent node
StrChild = ListBox1.Text ' Contains the name of the child node
End If
Next
'Treeview Select
UserForm1.TreeView1.SelectedItem.parent.Text = Trim(Left(StrParent, _
Application.WorksheetFunction.Find(" ", UserForm1.TreeView1.SelectedItem.parent.Text, 1)))
UserForm1.TreeView1.SelectedItem.parent.Child.Text = Trim(Left(StrChild, _
Application.WorksheetFunction.Find(" ", UserForm1.TreeView1.SelectedItem.parent.Child.Text, 1)))


Can anyone help with this please

thanks

gibbo