none
how to add node to parrticular tree node RRS feed

Answers

  • It depons on your Year node. So you must say in which year you want to add

    See the following examle

    2008->First root node, so it postion is 0 th node

    2009->Second root node,so its position is 1 st root node

    2010>Second root node,so its position is 2nd  root node

    Use

    'if youw ant to add 2008 then
    TreeNode.Nodes(0).Nodes.Add() 
    'if youw ant to add 2009 then
    TreeNode.Nodes(1).Nodes.Add() 
    'if youw ant to add 2010 then
    TreeNode.Nodes(2).Nodes.Add() 
    'etc..
    'function

     


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"

    Wednesday, July 4, 2012 10:32 AM

All replies

  • Use TreeNode.Nodes.Add() function.


    Please mark this post as answer if it solved your problem. Happy Programming!

    Tuesday, July 3, 2012 11:39 AM
  • i have treenode for each year ,2008,2009,2010

    but if i add month  in 2008 its getting added in 2010 only

      If parentnode Is Nothing Then
                        parentnode = New TreeNode(yr, yr)
                        new_date = dr("newsec_date")
                        month = array(new_date.Month - 1)
                        Dim child As New TreeNode(month, month)
                        parentnode.Collapse()
    
                        Select Case new_date.Month
                            Case 1
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                jan.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(jan)
                                jan.Collapse()
                            Case 2
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                feb.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(feb)
                                feb.Collapse()
                            Case 3
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                mar.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(mar)
                                mar.Collapse()
                            Case 4
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                apr.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(apr)
                                apr.Collapse()
                            Case 5
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                may.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(may)
                                may.Collapse()
                            Case 6
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                jun.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(jun)
                                jun.Collapse()
                            Case 7
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                jul.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(jul)
                                jul.Collapse()
                            Case 8
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                aug.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(aug)
                                aug.Collapse()
                            Case 9
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                sep.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(sep)
                                sep.Collapse()
    
                            Case 10
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                oct.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(oct)
                                oct.Collapse()
                            Case 11
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                nov.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(nov)
                                nov.Collapse()
                            Case 12
                                Dim grandchildnode As New TreeNode(dr("newsec_title"), dr("newsec_id"))
                                dec.ChildNodes.Add(grandchildnode)
                                parentnode.ChildNodes.Add(dec)
                                dec.Collapse()
    
                        End Select
                        ' parentnode.SelectAction = TreeNodeSelectAction.Expand
                        Treeview1.Nodes.Add(parentnode)
    
    
                    Else
    
                        new_date = dr("newsec_date")
                        month = array(new_date.Month - 1)
                        Dim child As New TreeNode(month, month)
                        parentnode.Collapse()
      End If


    • Edited by SSmadhu Monday, August 27, 2012 9:03 AM
    Tuesday, July 3, 2012 4:23 PM
  • It depons on your Year node. So you must say in which year you want to add

    See the following examle

    2008->First root node, so it postion is 0 th node

    2009->Second root node,so its position is 1 st root node

    2010>Second root node,so its position is 2nd  root node

    Use

    'if youw ant to add 2008 then
    TreeNode.Nodes(0).Nodes.Add() 
    'if youw ant to add 2009 then
    TreeNode.Nodes(1).Nodes.Add() 
    'if youw ant to add 2010 then
    TreeNode.Nodes(2).Nodes.Add() 
    'etc..
    'function

     


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"

    Wednesday, July 4, 2012 10:32 AM
  • Hello SSmadu

    I see no .Net base class problem in your question it looks more for the forum

    http://social.msdn.microsoft.com/Forums/en-US/winforms/threads


    Success
    Cor

    Thursday, July 5, 2012 6:03 AM
  • ya thnx for the help

    but now i m facing issue if i have 2 dates in same month i am not able to add it in same node

    example i have 10-1-11 , 25-01-11 both coming in jan month so i want 2011 as treenode n jan should shows both dates but i m not able to do dat

    Tuesday, November 6, 2012 9:49 AM