private void BtnRegister_Click(object sender, EventArgs e) { // get data string username = TextBoxUsername.Text; string email = TextBoxEmail.Text; string password = TextBoxPassword.Text; int userLevel = 1; if (isAdmin) { userLevel = getAdminUserLevelRadioBtnValue(); if (userLevel == -1) { //if for some reason no radio btn set (should default to student) MessageBox.Show("Please select a userlevel for this new student"); return; } } //check fields valid if (username.Length == 0 || email.Length == 0 || password.Length == 0) { MessageBox.Show("Please Fill in all text boxes."); return; } if (userLevel == 1 || userLevel == 2) // has to be student or admin user { //run update method //bool result = userLogic.insertNewUser(username, email, password, userLevel); bool result = dtFunc.getBool(ws.insertNewUser(username, email, password, userLevel)); if (result) { //reset signUp pg class vars resetSignUpPgAdminStatus(); if (isAdmin) { //for more details go to STUDENT SETTINGS return btn method Form mainform = Application.OpenForms["MainMenu"]; mainform.Show(); this.Close(); } //for more details go to STUDENT SETTINGS return btn method Form login = Application.OpenForms["Login"]; login.Show(); this.Close(); } else { MessageBox.Show("DB returned false"); } } else { MessageBox.Show("UserLevel out of range"); return; } }