Click here to Skip to main content
15,900,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
On form 1 I have this button as a test

public void button1_Click(object sender, EventArgs e)
{
treeView1.Nodes.Add("object");
}


i want to do the exact same function but with a button on form 2

Form1 Form1 = new Form1()

public void button1_Click(object sender, EventArgs e)
{
Form1.treeView1.Nodes.Add("stripper");
}

I have a feeling it's something very simple and stupid but i'm stuck.

Any help would be appreciated

What I have tried:

I have tried to add a variable to Form1 and call it from Form2, and the program doesn't show any errors so that's why I am so confused.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900