TreeView Control in VB.NET 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lathamoulali
    New Member
    • May 2008
    • 25

    TreeView Control in VB.NET 2005

    Hello Friends,

    I am migrating the code from VB 6.0 to VB.NET 2005.
    I am not able to translate the following code .

    In VB6.0 for treeview control to add the nodes to it , i have used
    mytreeview.node s.add(parent,Tr eeRelationshipC onstants.tvwChi ld, , Text)
    but in VB.NET i am unable to find the Equivalent code for TreeRelationshi pConstants.tvwC hild .
    Please post the solution as soon as possible.

    Thanks,
    LATHA.
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    You can try this code:

    Code:
       'This is parent node variable
            Dim pnode As New TreeNode
            'This is child node variable
            Dim cnode As New TreeNode
    
            pnode.Text = "Root"
            cnode.Text = "Child"
    
            ''Add child node
            pnode.Nodes.Add(cnode)
    
            ''Add parrent node
            TreeView1.Nodes.Add(pnode)

    Comment

    Working...