Basically when a user enters data into a textfield on Form2, I want that data to be stored into a variable then when users selects the button enter, Form2 will hide and Form1 will appear. I then want Form1 to display the data entered in the textfield from Form2 in a new textfield.
This is my attempt, but it doesn’t work
On Form 2…
public string Player1 {get; set;}
private void pvpPlay_Click(object sender, EventArgs e)
{
Player1 = txtPlayer1.Text;
Form1 op = new Form1();
op.Show();
this.Hide();
}
Then on Form1 to call this I put…
Form2 f = new Form2();
txtTest.Text = f.Player1;
But it doesn’t work. Hopefully someone knows the answer.
I would prefer the using of a simple Callback function like this:
Everytime you call
GetSomeProperty.Invoke();the Func will call the get accessor and return it from the first Form