private void button1_Click(object sender, EventArgs e) { Data_Access db = new Data_Access(); int verificationNumber = db.CheckEmail(RegEmailTxt.Text); if (RegEmailTxt.Text == "" || RegPasswordConfirmTxt.Text == "" || RegPasswordTxt.Text == "") { MessageBox.Show("Please fill out required fields"); } else if (verificationNumber == 1) { MessageBox.Show("That email has already been registered with another acccount"); } else if (RegPasswordTxt.Text.Length < 5) { MessageBox.Show("Password must be at least 5 characters"); } else if (RegPasswordTxt.Text != RegPasswordConfirmTxt.Text) { MessageBox.Show("Passwords do not match, please try again"); } else { // Takes all textbox info and adds it to database db.AddUser(RegFNameTxt.Text, RegLNameTxt.Text, RegEmailTxt.Text, RegPasswordTxt.Text); MessageBox.Show("Account successfully created!"); // Clears the fields RegFNameTxt.Text = ""; RegLNameTxt.Text = ""; RegEmailTxt.Text = ""; RegPasswordTxt.Text = ""; RegPasswordConfirmTxt.Text = ""; this.Close(); } }
private void button1_Click(object sender, EventArgs e) { Data_Access db = new Data_Access(); int ID = db.VerifyUser(EmailTextBox.Text, PasswordTextBox.Text); // If ID = 0 that means no record exists with that email/password if (ID == 0) { MessageBox.Show("Invalid email/password combo"); } // else close page and open home page else { HomeForm homeform = new HomeForm(); homeform.Location = this.Location; homeform.StartPosition = FormStartPosition.Manual; homeform.Show(); this.Close(); } }