private void btnRegister_Click(object sender, EventArgs e) { string username = txtUsername.Text; string password = txtPassword.Text; string password2 = txtPassword2.Text; Int32.TryParse(txtStaffId.Text, out var staffId); //validate all the registration inputs bool allInputsValid = ValidateInputs(username, password, password2, staffId); if (allInputsValid) { //if all inputs are validated, send the registration data to the database and add our new account var ad = new AccountsData(); var account = new AccountBase(username, password, staffId); ad.AddAccount(account); Dispose(); Login.Show(); //user message to let them know their registration was successful var message = new UserMessage(); message.Show("Your account has been successfully created!"); } }