FORM 1:
public partial class Form1 : Form
{
public int c;
public Form1()
{
InitializeComponent();
}
public void button2_Click(object sender, EventArgs e)
{
c = c + 1;
coinsLabel.Text = c.ToString();
}
public void button1_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2 ();
form2.Show();
Hide();
}
FORM 2:
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public void BackButton_Click(object sender, EventArgs e)
{
var form1 = new Form1();
form1.Show();
Hide();
}
private void button1_Click(object sender, EventArgs e)
{
var form1 = new Form1();
if (form1.c >= 10)
{
legnoLabel.Text = "preso";
}
}
public void legnoLabel_TextChanged(object sender, EventArgs e)
{
var form1 = new Form1();
form1.c = form1.c -500;
}
private void Form2_Load(object sender, EventArgs e)
{
}
}
}