I'm using two forms. In first Form1
I have a TextBox
from which I send a value into a class Class1
.
Here is my Form1
Code:
Class1 ss = new Class1();
ss.name = textBox1.Text;
Here is My Class Code:
class Class1
{
public string name;
}
But when I open another Form. Example Form2
and I'm trying to take the value from Class1
it returns null
.
Here is my Form2
Code:
Class ss = new Class();
textBox2.Text = ss.name;
How can I use public string name
for any Form I open?