Hi there !

I have a tree view control and a button in Form1. The button takes me to Form2 which has a text box and a save button.

What I'm trying to do is get the button on Form2 to add what i have typed in the textbox as a tree node in Form 1

I'm completely stumped and any advice / code snippets that could get me started on solving this problem would be greatly appreciated.

Thanks !

Set the property TextBox1.Modifiers=Public on Form2.

Form1

...
    private void button1_Click(object sender, EventArgs e)
        {
            Form2 f = new Form2();
            f.ShowDialog();
            treeView1.Nodes.Add(f.textBox1.Text);
        }
 ...

Form2

...
private void button1_Click(object sender, EventArgs e)
        {
          Close();
        }
...

that works great !

thanks a lot for the speedy reply !

Thanks! Please mark this thread as solved if you have found an answer to your question and good luck!

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.