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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Treeview

Status
Not open for further replies.

jnavarro

Programmer
Dec 1, 2003
89
US
I am very unfamiliar with treeview. I am trying to add data however I cannot figure how to add the child.

Here is what I am trying to do to add the parent.
.Nodes.Add(drCurrent("Store"))

Does anyone know how to add the child.
 
This is a method I use on a base navigation form. It allows you to pass in the Text to be displayed (value), the parent value, and an icon to use. The form has an image list called ilstNavigatorIcons that holds all of the icons passed in.

Code:
  Public Sub AddNode(ByVal Value As String, ByVal ParentValue As String, ByVal Icon As System.Drawing.Icon)
    Dim ParentNode As TreeNode
    Dim NewNode As New TreeNode()

    NewNode.Text = Value
    ilstNavigatorIcons.Images.Add(Icon)
    NewNode.ImageIndex = ilstNavigatorIcons.Images.Count - 1
    NewNode.SelectedImageIndex = ilstNavigatorIcons.Images.Count - 1

    If ParentValue = "" Then
      tvwNavigator.Nodes.Add(NewNode)
    Else
      For Each ParentNode In Me.tvwNavigator.Nodes
        If Not NodeRecursiveSearch(ParentNode, ParentValue).Text = "NotFound" Then
          Exit For
        End If
      Next
      ParentNode.Nodes.Add(NewNode)
    End If
  End Sub

----------------------
 
Thanks for the information. This gave me a great start in figuring my issue out
 
I was able to display the information. However, I am trying to use the selectitem when the user click on the treeview the information is then transfer to the text boxes. How can you transfer the parent and child node to the text box.

here is what I got so far
txtStore.Text = treeMissing.SelectedNode.Nodes(.SelectedNode.Index).Text

can someone help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top