954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Adding tree nodes at runtime (two forms)

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 !

chupoi
Newbie Poster
6 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

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();
        }
...
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

that works great !

thanks a lot for the speedy reply !

chupoi
Newbie Poster
6 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

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

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: