private void BtnRegister_Click(object sender, EventArgs e) { if (RbRegister.Checked == true) { if (W.CheckUser(TbUser.Text)) //Validates If The User Already Exists { LblMessage.Text = "This Username Already Exists"; //Displays A Message Clear(); } else if (TbUser.Text == "" || TbPass.Text == "") { LblMessage.Text = "You need to complete all fields"; Clear(); } else if (TbUser.TextLength > 15 || TbPass.TextLength > 15) { LblMessage.Text = "Your details need to be less than 15 characters"; Clear(); } else { W.Register(TbUser.Text, TbPass.Text); PnlUnlogged.Visible = false; LoggedIn = true; } } else if (RbLogin.Checked == true) { if (W.LoggedIn(TbUser.Text)) { LblMessage.Text = "This Username Is Already Logged In"; //Displays A Message Clear(); } else if (TbUser.Text == "" || TbPass.Text == "") { LblMessage.Text = "You need to enter both your credentials"; Clear(); } else if (TbUser.TextLength > 10 || TbPass.TextLength > 10) { LblMessage.Text = "Your details need to be less than 15 characters"; Clear(); } else if (W.Login(TbUser.Text, TbPass.Text)) { PnlUnlogged.Visible = false; LoggedIn = true; } else { LblMessage.Text = "There was no account assoicated with those details"; } } else { LblMessage.Text = "Please select if you want to register or login"; } if (LoggedIn == true) { PnlLogged.Visible = true; } }