I'm new to c# programming, and I am a little stuck on how to make a variable available across multiple forms. I read that i should make a public static class, however, my code is as follows:
private void btnLogin_Click(object sender, EventArgs e)
{
accountNo = txtBoxAccntNo.Text;
valid = validate(); //uses validate() method to check validity
if (valid == true && accountNo == "11111111")
{
ManagerScreen Manager = new ManagerScreen();
this.Hide();
Manager.Show();
}
else if (valid == true)
{
s customer = new s();
this.Hide();
customer.Show();
}
else
{
if (count == 2)
{
this.Close();
}
count += 1;
txtBoxAccntNo.Clear();
txtBoxPinNo.Clear();
}
}
I want to make the variable AccountNo available on other forms, however, when its like this i'm just not sure how to. I'm sure there is a simple solution and any advice is appreciated.
Sincerely,
p.w