Hi all,

I am trying to add the text entered into a textbox in a child form as a node in a TreeView on a parent form. Any suggestions for implementing this bit of functionality?
The parent or main form contains a treeview control with four nodes when loaded. This form contains a button labelled "Add new node" which, when clicked, takes the user to a second form which prompts for the node via a text box. The second form has a button labelled 'Save" which, when clicked, adds the text in the textbox as a node in the TreeView control on the first form.

Thanks for any suggestions

Add TreeView control and set internal value to the Modifier and false to HideSelection property of TreeView1 of main or Parent form (say Form1).

Click handler of button in child form (say Form2)

Form1 parent = this.MdiParent  as Form1;
 if(parent.treeView1.SelectedNode!=null)
    parent.treeView1.SelectedNode.Nodes.Add(textBox1.Text);
 parent.treeView1.Refresh();

Add TreeView control and set internal value to the Modifier and false to HideSelection property of TreeView1 of main or Parent form (say Form1).

Click handler of button in child form (say Form2)

Form1 parent = this.MdiParent  as Form1;
 if(parent.treeView1.SelectedNode!=null)
    parent.treeView1.SelectedNode.Nodes.Add(textBox1.Text);
 parent.treeView1.Refresh();

Thanks for your reply. I can't find the HideSelection property of the TreeView control.I should have added in my previous post that i am developing a Windows Mobile application using the .NET Compact Framework. Is this property not supported in the .NET Compact Framework?

Thanks

Hi all,

I am trying to add a textbox in a child form as a node in a TreeView on a parent form in VB .Net Windows Form. Any suggestions for implementing this bit of functionality?

Thanks for any suggestions

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.