Is it possible to add two nodes at a time dynamically to a treeview

Posted by Dorababu on Stack Overflow See other posts from Stack Overflow or by Dorababu
Published on 2010-12-29T14:33:04Z Indexed on 2010/12/29 14:54 UTC
Read the original article Hit count: 177

Filed under:
|
|

I am having a tree-view on my main form with initially some nodes as follows

        ACH
         |-> some.txt
            |->FileHeader
              |->BatchHeader

Now at this point i will have to add 2 child nodes at a time to BatchHeader. This nodes i will pass as strings from child forms

My sample code that i added some nodes is as follows

  public void loadingDatafrom(string filename, bool str)
    {
        if (Append.oldbatchcontrol != filename)
        {
            if (tvwACH.SelectedNode.Text == "FileHeader")
            {
                tvwACH.SelectedNode.Nodes.Add(filename);
            }
            if (tvwACH.SelectedNode.Text == "BatchHeader" && filecontrolvariables.m_gridclick == false)
            {
                tvwACH.SelectedNode.Nodes.Add(filename);
               **I got this idea tvwach.SelectedNode.Lastnode.Nodes.Add("Node");**
            }
        }
     }

Can any one give an idea to add 2 nodes as child to the existing node ..

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms