Account Numbers are 6 digits in length when inserted into the array. They are stored as strings as they can begin with a 0.
As an example, I always use the Account Number of 123456, however, when I put that in the TextBox and click btnLogIn, it gives me an error.
logInVerified is a method that will show or hide another text box depending on the users input.
private void btnLogIn_Click(object sender, EventArgs e)
{
for (int i = 0; i < account.Accounts; i++)
{
if (txtAccountNum.Text == account.getAccountNumber(i))
{
logInVerified(true);
txtBalance.Text = Convert.ToString(account.getBalance(i));
}
else if (i == account.Accounts)
{
MessageBox.Show("No account found, please check Account and PIN numbers and try again.", "No account found", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
txtAccountNum.Textactually equalsaccount.getAccountNumber(i)at any point.operator ==(object, object)overload? It tests for reference equality (identical instances) only. The overload of==is statically (non-virtually) bound at compile-time.