Firstly I would like to thank anyone taking the time to look over this.
My issue as I am quite new to C# is that i need to declare a class variable that will store the current balance of the user.
The reason that it is a class variable, is that it needs to be accessed by many methods.
It is my first time having to deal with storing variables in other classes. If anyone knows how to change a variable that exists in a different class that would fix my issue!
private class Balance
{
// (1) I'm not sure what to put here
}
private void buttonDeposit_Click(object sender, EventArgs e)
{
try
{
userInput = Convert.ToDecimal(textBoxUserAmount.Text);
}
catch
{
MessageBox.Show("Numbers only Please");
return;
}
//CheckDeposit is a boolean method checking if the users input is
//between certain numbers
if (CheckDeposit(check) == true)
{
// (2) here I want it to call Balance and += userInput but I
// have no idea how to
}
else
{
MessageBox.Show("Incorrect amount, make sure the input is between 20 and 200 inclusive");
return;
}
}