public void perfectInputChecker() { checker = false; userAdminChecker = textBoxUserName.Text; RegexUtilities util = new RegexUtilities(); //Name if (textBoxFullName.Text == "") { labelName.ForeColor = Color.Red; labelName.Text = "You can't leave this empty."; labelName.Visible = true; checker = true; } else if (textBoxFullName.Text.Length > 30) { labelName.ForeColor = Color.Red; labelName.Text = "Name should be within 30 characters."; labelName.Visible = true; checker = true; } if (textBoxUserName.Text == "") { labelUserName.ForeColor = Color.Red; labelUserName.Text = "You can't leave this empty."; labelUserName.Visible = true; checker = true; } else if (textBoxUserName.Text.ToLower().Replace(" ", "") == "admin") { labelUserName.ForeColor = Color.Red; labelUserName.Text = "You can't open an account with User Name: " + userAdminChecker; labelUserName.Visible = true; checker = true; } else if (textBoxUserName.Text.Contains(" ")) { labelUserName.ForeColor = Color.Red; labelUserName.Text = "User Name can't contain any space."; labelUserName.Visible = true; checker = true; } else if (textBoxUserName.Text.Length > 15 || textBoxUserName.Text.Length < 5) { labelUserName.ForeColor = Color.Red; labelUserName.Text = "User Name should between 5 to 15 characters."; labelUserName.Visible = true; checker = true; } else if (textBoxUserName.Text.Length >= 5 && textBoxUserName.Text.Length <= 15 ) { validUserName(); } string todaysDate = DateTime.Now.ToString("yyyy/MM/dd"); string givenDate = dateTimePicker1.Value.ToString("yyyy/MM/dd"); yearToday = int.Parse(DateTime.Now.ToString("yyyy")); yearGiven = int.Parse(dateTimePicker1.Value.ToString("yyyy")); yearCalculation = yearToday - yearGiven; //DateTime.Now.ToString("M/d/yyyy"); // string theDate = dateTimePicker1.Value.ToShortDateString(); //string theDate = dateTimePicker1.Value.ToString("yyyy-MM-dd"); if (textBoxPassword.Text == "") { labelPassword.ForeColor = Color.Red; labelPassword.Text = "You can't leave this empty."; labelPassword.Visible = true; checker = true; } else if (textBoxPassword.Text.Length > 30 || textBoxPassword.Text.Length < 5) { labelPassword.ForeColor = Color.Red; labelPassword.Text = "Password should between 5 to 30 characters."; labelPassword.Visible = true; checker = true; } if (textBoxRePassword.Text == "") { labelRePassword.ForeColor = Color.Red; labelRePassword.Text = "You can't leave this empty."; labelRePassword.Visible = true; checker = true; } if (todaysDate == givenDate) { labelBirthday.ForeColor = Color.Red; labelBirthday.Text = "Enter your birthday."; labelBirthday.Visible = true; checker = true; } else if (yearCalculation < 0 || (yearCalculation > 0 && yearCalculation <= 4)) { labelBirthday.ForeColor = Color.Red; if (yearCalculation == 1) { labelBirthday.Text = "You are not " + yearCalculation + " year old!"; } else { labelBirthday.Text = "You are not " + yearCalculation + " year old!"; } labelBirthday.Visible = true; checker = true; } if (radioButtonMale.Checked == false && radioButtonFemale.Checked == false) { labelGender.ForeColor = Color.Red; labelGender.Text = "Select the gender."; labelGender.Visible = true; checker = true; } if (textBoxEmail.Text == "") { labelEmail.ForeColor = Color.Red; labelEmail.Text = "You can't leave this empty."; labelEmail.Visible = true; checker = true; } else if(!util.IsValidEmail(textBoxEmail.Text.ToString())) { labelEmail.ForeColor = Color.Red; labelEmail.Text = "Give a valid Email Address"; labelEmail.Visible = true; checker = true; } if (comboBoxCountry.Text == "") { labelCountry.ForeColor = Color.Red; labelCountry.Text = "Select your country."; labelCountry.Visible = true; checker = true; } validEmailAddress(); }