private void loginButton_Click(object sender, EventArgs e) { bingoLib account = new bingoLib(); // Creates an object of the class to be used // Checks that there is an account with the user credentials account = account.GetAccount(usernameTextBox.Text, passwordTextBox.Text); //If the returned object has an empty username, then there was no match if (string.IsNullOrEmpty(account.Username)) { //Display an error message string message = "Invalid Username or Password"; string title = "Failed Login"; MessageBoxButtons buttons = MessageBoxButtons.OK; DialogResult resultone = MessageBox.Show(message, title, buttons, MessageBoxIcon.Exclamation); } // If there is a match, go on to the game board else if (account.Username == usernameTextBox.Text && account.Password == passwordTextBox.Text) { this.Hide(); Form2 frm2 = new Form2(account); frm2.Show(); } }
// When the user signs in or successfully logs in, it calls Form2 public Form2(bingoLib acc) { InitializeComponent(); account = acc; // Copy the object received, containing all the account information nameLabel.Text = account.Fname + " " + account.Lname; //Dsiplay the account's name balanceLabel.Text = "$" + account.Balance; // Displays the account's balance }
bingoLib account = new bingoLib(); //Used to copy the object sent from Form2 public Form4(bingoLib acc) { InitializeComponent(); account = acc; //Copies the account information //Fill the fields displayed with the account's information to be edited updtFirstTextBox.Text = acc.Fname; updtLastTextBox.Text = acc.Lname; updtUsernameTextBox.Text = acc.Username; updtPasswordTextBox.Text = acc.Password; updtCardInfoTextBox.Text = acc.CardInfo; updtCvvTextBox.Text = acc.Cvv; updtBalanceTextBox.Text = acc.Balance; }